diff --git a/src/wps/httpread.c b/src/wps/httpread.c index 180b572c1..d6c2b62ae 100644 --- a/src/wps/httpread.c +++ b/src/wps/httpread.c @@ -506,10 +506,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx) new_alloc_nbytes < (h->content_length + 1)) new_alloc_nbytes = h->content_length + 1; if (new_alloc_nbytes < h->body_alloc_nbytes || - new_alloc_nbytes > h->max_bytes) { + new_alloc_nbytes > h->max_bytes + + HTTPREAD_BODYBUF_DELTA) { wpa_printf(MSG_DEBUG, - "httpread: Unacceptable body length %d", - new_alloc_nbytes); + "httpread: Unacceptable body length %d (body_alloc_nbytes=%u max_bytes=%u)", + new_alloc_nbytes, + h->body_alloc_nbytes, + h->max_bytes); goto bad; } if ((new_body = os_realloc(h->body, new_alloc_nbytes))