summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-12-13 15:44:22 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-12-13 15:44:22 +0000
commitd56c1fdf14c888557cd9dd54a402fc06bfa3de22 (patch)
tree0e536414983ddbc6e8648186f1d587092a574e81
parent81ad353ec23e207549eb1f1cbd48cd7e68ba1af2 (diff)
downloadphp-git-d56c1fdf14c888557cd9dd54a402fc06bfa3de22.tar.gz
Fixed bug #50451 (http wrapper breaks on 2048 char long headers)
# Improvement on the fix for bug #49851
-rw-r--r--NEWS2
-rw-r--r--ext/standard/http_fopen_wrapper.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 3d059219ba..83b236178b 100644
--- a/NEWS
+++ b/NEWS
@@ -98,7 +98,7 @@ PHP NEWS
- Fixed bug #49866 (Making reference on string offsets crashes PHP). (Dmitry)
- Fixed bug #49855 (import_request_variables() always returns NULL). (Ilia,
sjoerd at php dot net)
-- Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia)
+- Fixed bug #49851, #50451 (http wrapper breaks on 1024 char long headers). (Ilia)
- Fixed bug #49800 (SimpleXML allow (un)serialize() calls without warning).
(Ilia, wmeler at wp-sa dot pl)
- Fixed bug #49719 (ReflectionClass::hasProperty returns true for a private
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9e144b7954..3ca614b771 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -610,8 +610,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
size_t http_header_line_length;
if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') {
char *e = http_header_line + http_header_line_length - 1;
- if (*e != '\n') { /* partial header */
- php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length);
+ if (*e != '\n') {
+ do { /* partial header */
+ php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length);
+ e = http_header_line + http_header_line_length - 1;
+ } while (*e != '\n');
continue;
}
while (*e == '\n' || *e == '\r') {