diff options
| author | Anatol Belski <ab@php.net> | 2014-12-01 14:43:22 +0100 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2014-12-01 14:43:22 +0100 |
| commit | f33bd9c846008d00b78f86586d8ecc1595a4753b (patch) | |
| tree | 625198243d22752e09b36ea1ff6c0970767eddbb | |
| parent | d964832255b266c6e0c99efcebce3e0ae85fd080 (diff) | |
| parent | cb6dea6ea81eab46d54a0511da24fbd6eee1abe6 (diff) | |
| download | php-git-f33bd9c846008d00b78f86586d8ecc1595a4753b.tar.gz | |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
fix possible null pointer math
| -rw-r--r-- | sapi/cgi/cgi_main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index c0b040a6d0..e1d374fb0f 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--; } |
