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

index fe55a2ae98e862539af07211a589c27a5fb17f52..f3eb0d9398e53747cebc8cc6bdaeb048ae6bb3d1 100644 (file)
@@ -591,7 +591,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 */