httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved is called nested from httpd_post_receive_data() (bug #50424)

# Conflicts:
#	CHANGELOG
This commit is contained in:
goldsimon 2017-03-01 22:08:05 +01:00
parent 168fa1c38a
commit fe6e1bd4af

View File

@ -1692,7 +1692,14 @@ http_post_rxpbuf(struct http_state *hs, struct pbuf *p)
hs->post_content_len_left -= p->tot_len;
}
}
#if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
/* prevent connection being closed if httpd_post_data_recved() is called nested */
hs->unrecved_bytes++;
#endif
err = httpd_post_receive_data(hs, p);
#if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND
hs->unrecved_bytes--;
#endif
if (err != ERR_OK) {
/* Ignore remaining content in case of application error */
hs->post_content_len_left = 0;