diff options
| author | Stanislav Malyshev <stas@php.net> | 2014-12-30 01:26:18 -0800 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2014-12-30 01:26:53 -0800 |
| commit | 4c0f17caca1fc0a9fab66ada9c43c960011308f0 (patch) | |
| tree | 87f64cb5f6faa05f5da665b6effc23db298bfd17 /sapi/cgi/cgi_main.c | |
| parent | 24125f0f26f3787c006e4a51611ba33ee3b841cb (diff) | |
| parent | 71c970077d9ad46fc595095c50f211b3136d6459 (diff) | |
| download | php-git-4c0f17caca1fc0a9fab66ada9c43c960011308f0.tar.gz | |
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)
Diffstat (limited to 'sapi/cgi/cgi_main.c')
| -rw-r--r-- | sapi/cgi/cgi_main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index e1d374fb0f..caf41fbaea 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2437,14 +2437,17 @@ consult the installation file that came with this distribution, or visit \n\ int i = 1; c = file_handle.handle.stream.mmap.buf[i++]; - while (c != '\n' && c != '\r' && c != EOF) { + while (c != '\n' && c != '\r' && i < file_handle.handle.stream.mmap.len) { c = file_handle.handle.stream.mmap.buf[i++]; } if (c == '\r') { - if (file_handle.handle.stream.mmap.buf[i] == '\n') { + if (i < file_handle.handle.stream.mmap.len && file_handle.handle.stream.mmap.buf[i] == '\n') { i++; } } + if(i > file_handle.handle.stream.mmap.len) { + i = file_handle.handle.stream.mmap.len; + } file_handle.handle.stream.mmap.buf += i; file_handle.handle.stream.mmap.len -= i; } |
