com php-src: fix possible null pointer math: sapi/cgi/cgi_mai n.c

From: Date: Mon, 01 Dec 2014 13:40:35 +0000
Subject: com php-src: fix possible null pointer math: sapi/cgi/cgi_mai n.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-83461@lists.php.net to get a copy of this message
Commit: cb6dea6ea81eab46d54a0511da24fbd6eee1abe6 Author: Anatol Belski <ab@php.net> Mon, 1 Dec 2014 14:40:35 +0100 Parents: a3a0e49586b2bf37b7969f6f5722d9b2aa797356 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cb6dea6ea81eab46d54a0511da24fbd6eee1abe6 Log: fix possible null pointer math Changed paths: M sapi/cgi/cgi_main.c Diff: diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b1e12f7..41ebd49 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1661,13 +1661,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--; }

« previous php.cvs (#83461) next »