]> granicus.if.org Git - php/commitdiff
MFH: fix possible invalid read (reproducible only on big-endian machines)
authorAntony Dovgal <tony2001@php.net>
Mon, 18 Dec 2006 13:16:54 +0000 (13:16 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 18 Dec 2006 13:16:54 +0000 (13:16 +0000)
main/SAPI.c

index a760ded4a81ebf9d1bef0e82aba60c237290303f..5053c621ad0904dffd841891c77e7288706080e4 100644 (file)
@@ -565,7 +565,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
        header_line = estrndup(header_line, header_line_len);
 
        /* cut of trailing spaces, linefeeds and carriage-returns */
-       while(isspace(header_line[header_line_len-1])) 
+       while(header_line_len && isspace(header_line[header_line_len-1])) 
                  header_line[--header_line_len]='\0';
        
        /* new line safety check */