upnphttp: Check for invalid Content-Length header.

This commit is contained in:
Justin Maggard 2015-07-30 13:44:42 -07:00
parent b94f04d6ef
commit 8e201fec7b

View File

@ -161,7 +161,10 @@ ParseHttpHeaders(struct upnphttp * h)
p = colon; p = colon;
while(*p && (*p < '0' || *p > '9')) while(*p && (*p < '0' || *p > '9'))
p++; p++;
h->req_contentlen = atoi(p); if(h->req_contentlen < 0) {
DPRINTF(E_WARN, L_HTTP, "Invalid Content-Length %d", h->req_contentlen);
h->req_contentlen = 0;
}
} }
else if(strncasecmp(line, "SOAPAction", 10)==0) else if(strncasecmp(line, "SOAPAction", 10)==0)
{ {
@ -408,9 +411,7 @@ ParseHttpHeaders(struct upnphttp * h)
next_header: next_header:
line = strstr(line, "\r\n"); line = strstr(line, "\r\n");
if (!line) if (!line)
{
return; return;
}
line += 2; line += 2;
} }
if( h->reqflags & FLAG_CHUNKED ) if( h->reqflags & FLAG_CHUNKED )