Skip to content

Commit 16b904c

Browse files
committed
Merge branch 'PHP-5.6'
* PHP-5.6: FIx bug #68618 (out of bounds read crashes php-cgi) Fixed bug #68676 (Explicit Double Free) Fixed bug #68676 (Explicit Double Free)
2 parents f2fc1bd + 4c0f17c commit 16b904c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sapi/cgi/cgi_main.c

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

24162416
c = file_handle.handle.stream.mmap.buf[i++];
2417-
while (c != '\n' && c != '\r' && c != EOF) {
2417+
while (c != '\n' && c != '\r' && i < file_handle.handle.stream.mmap.len) {
24182418
c = file_handle.handle.stream.mmap.buf[i++];
24192419
}
24202420
if (c == '\r') {
2421-
if (file_handle.handle.stream.mmap.buf[i] == '\n') {
2421+
if (i < file_handle.handle.stream.mmap.len && file_handle.handle.stream.mmap.buf[i] == '\n') {
24222422
i++;
24232423
}
24242424
}
2425+
if(i > file_handle.handle.stream.mmap.len) {
2426+
i = file_handle.handle.stream.mmap.len;
2427+
}
24252428
file_handle.handle.stream.mmap.buf += i;
24262429
file_handle.handle.stream.mmap.len -= i;
24272430
}

0 commit comments

Comments
 (0)