bail out if reading HTTP headers failed
authorAntony Dovgal <tony2001@php.net>
Tue, 8 Nov 2011 16:38:56 +0000 (16:38 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 8 Nov 2011 16:38:56 +0000 (16:38 +0000)
ext/standard/http_fopen_wrapper.c

index a7a708b1b28297be8c1bde75504ad55fa80cedb5..a0feec5e4b233d61f863e7d3ea225333dfc3b8d8 100644 (file)
@@ -719,7 +719,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;