summaryrefslogtreecommitdiffstats
path: root/bug70755.patch
blob: 1090b87e4fe295df1429753158bc4d034d770e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Backported from 5.5 for 5.4 by Remi Collet

From be19dbcb84fea0001e53cea2732c00de7ae6c371 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Tue, 8 Dec 2015 00:10:07 -0800
Subject: [PATCH] Fixed bug #70755: fpm_log.c memory leak and buffer overflow

---
 NEWS                   | 3 +++
 sapi/fpm/fpm/fpm_log.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index b0bf32a..187fe9b 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -446,6 +446,11 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
 				b += len2;
 				len += len2;
 			}
+			if (len >= FPM_LOG_BUFFER) {
+				zlog(ZLOG_NOTICE, "the log buffer is full (%d). The access log request has been truncated.", FPM_LOG_BUFFER);
+				len = FPM_LOG_BUFFER;
+				break;
+			}
 			continue;
 		}