miniupnpd/upnphttp: fix buffer allocation for response

increased default buffer size for HTTP response
check size of h->res_buf before building HTTP response
This commit is contained in:
Thomas Bernard 2012-10-05 00:28:06 +02:00
parent 1a458fe869
commit 5e48745eb3
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,8 @@
$Id: Changelog.txt,v 1.318 2012/10/04 22:11:55 nanard Exp $
2012/10/04:
increased default buffer size for HTTP response
2012/10/03:
Fix atoi() on null pointer in upnpsoap.c
properly set service/device version in SSDP messages
@ -7,6 +10,7 @@ $Id: Changelog.txt,v 1.318 2012/10/04 22:11:55 nanard Exp $
Enforce compliance for SUBSCRIBE messages (UPNP_STRICT mode)
Enforce compliance for UNSUBSCRIBE messages (UPNP_STRICT mode)
Ignore "-Wmissing-field-initializers" in upnpdescgen.c
check size of h->res_buf before building HTTP response
ENABLE_HTTP_DATE : add a Date: header to all HTTP responses
2012/09/27:

View File

@ -755,12 +755,13 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode,
int bodylen)
{
int templen;
if(!h->res_buf)
{
templen = sizeof(httpresphead) + 128 + bodylen;
if(!h->res_buf ||
h->res_buf_alloclen < ((int)sizeof(httpresphead) + 256 + bodylen)) {
if(h->res_buf)
free(h->res_buf);
templen = sizeof(httpresphead) + 256 + bodylen;
h->res_buf = (char *)malloc(templen);
if(!h->res_buf)
{
if(!h->res_buf) {
syslog(LOG_ERR, "malloc error in BuildHeader_upnphttp()");
return;
}