net-lwip: zero terminate string with headers in wget_lwip_fill_info()
authorAdriano Cordova <adrianox@gmail.com>
Tue, 26 Nov 2024 16:19:21 +0000 (13:19 -0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 4 Dec 2024 11:24:37 +0000 (12:24 +0100)
commitdc7c8a2532925fa526ca6bd35b0519d5e3e97aed
treecf3f5ac7e6fc89fd66c4b63ba648751b0939b3ee
parent737c2dca95e5c4fec208026f367a5333fbdad21f
net-lwip: zero terminate string with headers in wget_lwip_fill_info()

    This patch comes as a companion to the same patch but for the legacy
    net stack. Commit 1327c2a8d6 ("net/lwip: wget: integrate struct wget_info
    into wget code") introduced function wget_fill_info() which retrieves
    the headers from the HTTP server response. As we want to parse the
    string in later patches we need to ensure that it is NUL terminated.

    We must further check that wget_info->headers in not NULL.
    Otherwise a crash occurs.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
net/lwip/wget.c