]> granicus.if.org Git - php/commitdiff
bail out if reading HTTP headers failed
authorAntony Dovgal <tony2001@php.net>
Tue, 8 Nov 2011 13:30:58 +0000 (13:30 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 8 Nov 2011 13:30:58 +0000 (13:30 +0000)
ext/standard/http_fopen_wrapper.c

index 4567efc1f2169f4191b05c2b51ad4bb49d00b6dc..f477246e76adeb921115cfa66ed4540968fc366c 100644 (file)
@@ -716,7 +716,10 @@ finish:
                        char *e = http_header_line + http_header_line_length - 1;
                        if (*e != '\n') {
                                do { /* partial header */
-                                       php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length);
+                                       if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) == NULL) {
+                                               php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Failed to read HTTP headers");
+                                               goto out;
+                                       }
                                        e = http_header_line + http_header_line_length - 1;
                                } while (*e != '\n');
                                continue;