diff options
| author | Ondřej Surý <ondrej@sury.org> | 2015-01-26 11:35:34 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2015-01-26 11:35:34 +0100 |
| commit | 37df7e2d1076497e3295648878d39f5bceb8c4e1 (patch) | |
| tree | dbfd5d31f8a296d4cce366a0106bf500ca15c9f5 /sapi/cgi | |
| parent | d69b64eedc8c3c75da8074f761539ef2cb3ef4cb (diff) | |
| download | php-upstream/5.4.37.tar.gz | |
New upstream version 5.4.37upstream/5.4.37
Diffstat (limited to 'sapi/cgi')
| -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 b8ff878fe..0af98a47d 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2429,14 +2429,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; } |
