diff options
author | Ondřej Surý <ondrej@sury.org> | 2015-01-26 11:52:53 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2015-01-26 11:52:53 +0100 |
commit | 832b62efb8fceebb220116d8024d945a9bd31d7e (patch) | |
tree | e3c65d02b50180c7d7d7c21626d403d2eb87793a /sapi/cgi/cgi_main.c | |
parent | 60fede4c90746ef3408ed27a15dd405b3a46a83b (diff) | |
download | php-upstream/5.6.5+dfsg.tar.gz |
New upstream version 5.6.5+dfsgupstream/5.6.5+dfsg
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r-- | sapi/cgi/cgi_main.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index c0b040a6d..caf41fbae 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1664,13 +1664,15 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS_DC) /* {{{ */ { char *s, *p; - int len; + int len = 0; ALLOCA_FLAG(use_heap) if (h->header_len > 0) { p = strchr(h->header, ':'); - len = p - h->header; - if (p && (len > 0)) { + if (NULL != p) { + len = p - h->header; + } + if (len > 0) { while (len > 0 && (h->header[len-1] == ' ' || h->header[len-1] == '\t')) { len--; } @@ -2435,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; } |