Skip to content

Commit 4c0f17c

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: FIx bug #68618 (out of bounds read crashes php-cgi) Fixed bug #68676 (Explicit Double Free)
2 parents 24125f0 + 71c9700 commit 4c0f17c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
constructor). (dunglas at gmail dot com)
1818
. Fixed bug #68676 (Explicit Double Free). (Kalle)
1919

20+
- CGI:
21+
. Fix bug #68618 (out of bounds read crashes php-cgi). (Stas)
22+
2023
- cURL:
2124
. Fixed bug #67643 (curl_multi_getcontent returns '' when
2225
CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans)

sapi/cgi/cgi_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,14 +2437,17 @@ consult the installation file that came with this distribution, or visit \n\
24372437
int i = 1;
24382438

24392439
c = file_handle.handle.stream.mmap.buf[i++];
2440-
while (c != '\n' && c != '\r' && c != EOF) {
2440+
while (c != '\n' && c != '\r' && i < file_handle.handle.stream.mmap.len) {
24412441
c = file_handle.handle.stream.mmap.buf[i++];
24422442
}
24432443
if (c == '\r') {
2444-
if (file_handle.handle.stream.mmap.buf[i] == '\n') {
2444+
if (i < file_handle.handle.stream.mmap.len && file_handle.handle.stream.mmap.buf[i] == '\n') {
24452445
i++;
24462446
}
24472447
}
2448+
if(i > file_handle.handle.stream.mmap.len) {
2449+
i = file_handle.handle.stream.mmap.len;
2450+
}
24482451
file_handle.handle.stream.mmap.buf += i;
24492452
file_handle.handle.stream.mmap.len -= i;
24502453
}

0 commit comments

Comments
 (0)