diff options
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-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 b1e12f7324..41ebd494f4 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--; } |