summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/lwip/wget.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/lwip/wget.c b/net/lwip/wget.c
index 5a64f6887c9..263d6dab26c 100644
--- a/net/lwip/wget.c
+++ b/net/lwip/wget.c
@@ -40,8 +40,13 @@ struct wget_ctx {
static void wget_lwip_fill_info(struct pbuf *hdr, u16_t hdr_len, u32_t hdr_cont_len)
{
- if (wget_info->headers && hdr_len < MAX_HTTP_HEADERS_SIZE)
- pbuf_copy_partial(hdr, (void *)wget_info->headers, hdr_len, 0);
+ if (wget_info->headers) {
+ if (hdr_len < MAX_HTTP_HEADERS_SIZE)
+ pbuf_copy_partial(hdr, (void *)wget_info->headers, hdr_len, 0);
+ else
+ hdr_len = 0;
+ wget_info->headers[hdr_len] = 0;
+ }
wget_info->hdr_cont_len = (u32)hdr_cont_len;
}