upnphttp: ParseHttpHeaders() checks atoi() return
atoi() can return a negative value, and that can lead to problems later
This commit is contained in:
parent
60d1db157a
commit
3b5eacb3ae
|
@ -92,6 +92,10 @@ ParseHttpHeaders(struct upnphttp * h)
|
|||
while(*p < '0' || *p > '9')
|
||||
p++;
|
||||
h->req_contentlen = atoi(p);
|
||||
if(h->req_contentlen < 0) {
|
||||
syslog(LOG_WARNING, "ParseHttpHeaders() invalid Content-Length %d", h->req_contentlen);
|
||||
h->req_contentlen = 0;
|
||||
}
|
||||
/*printf("*** Content-Lenght = %d ***\n", h->req_contentlen);
|
||||
printf(" readbufflen=%d contentoff = %d\n",
|
||||
h->req_buflen, h->req_contentoff);*/
|
||||
|
|
Loading…
Reference in New Issue