diff options
-rw-r--r-- | net/wget.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/wget.c b/net/wget.c index 3bc2522cde5..5d70b7a82e0 100644 --- a/net/wget.c +++ b/net/wget.c @@ -208,8 +208,13 @@ static void wget_fill_info(const uchar *pkt, int hlen) const char *second_space; char *pos, *end; - if (wget_info->headers && hlen < MAX_HTTP_HEADERS_SIZE) - strncpy(wget_info->headers, pkt, hlen); + if (wget_info->headers) { + if (hlen < MAX_HTTP_HEADERS_SIZE) + strncpy(wget_info->headers, pkt, hlen); + else + hlen = 0; + wget_info->headers[hlen] = 0; + } //Get status code first_space = strchr(pkt, ' '); |