--- php-4.3.9/main/SAPI.c.cve0907
+++ php-4.3.9/main/SAPI.c
@@ -543,7 +543,7 @@
 	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 */

