summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/http.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/stream/http.c b/stream/http.c
index c94d6d4925..eb0ea701b6 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -350,6 +350,7 @@ http_is_header_entire( HTTP_header_t *http_hdr ) {
if( http_hdr==NULL ) return -1;
if( http_hdr->buffer==NULL ) return 0; // empty
+ if(http_hdr->buffer_size > 128*1024) return 1;
if( strstr(http_hdr->buffer, "\r\n\r\n")==NULL &&
strstr(http_hdr->buffer, "\n\n")==NULL ) return 0;
return 1;
@@ -414,12 +415,12 @@ http_response_parse( HTTP_header_t *http_hdr ) {
hdr_sep_len = 4;
ptr = strstr( http_hdr->buffer, "\r\n\r\n" );
if( ptr==NULL ) {
+ hdr_sep_len = 2;
ptr = strstr( http_hdr->buffer, "\n\n" );
if( ptr==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Header may be incomplete. No CRLF CRLF found.\n");
- return -1;
+ hdr_sep_len = 0;
}
- hdr_sep_len = 2;
}
pos_hdr_sep = ptr-http_hdr->buffer;
@@ -429,7 +430,12 @@ http_response_parse( HTTP_header_t *http_hdr ) {
ptr = hdr_ptr;
while( *ptr!='\r' && *ptr!='\n' ) ptr++;
len = ptr-hdr_ptr;
- if( len==0 ) break;
+ if (len == 0 || !memchr(hdr_ptr, ':', len)) {
+ mp_msg(MSGT_NETWORK, MSGL_ERR, "Broken response header, missing ':'\n");
+ pos_hdr_sep = ptr - http_hdr->buffer;
+ hdr_sep_len = 0;
+ break;
+ }
if (len > 16 && !strncasecmp(hdr_ptr + 4, "icy-metaint:", 12))
{
mp_msg(MSGT_NETWORK, MSGL_WARN, "Server sent a severely broken icy-metaint HTTP header!\n");