busybox: fix broken IPv6 address displaying in ifconfig
[openwrt/openwrt.git] / package / utils / busybox / patches / 010-networking-fix-uninitialized-memory-when-displaying-.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Mon, 18 Jan 2016 12:03:45 +0100
3 Subject: [PATCH] networking: fix uninitialized memory when displaying IPv6
4 addresses
5
6 After commit 8e74adab0107658e3dc04ed342206272a284f43e
7 ("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport")
8 INET_sprint6 uses more than just sin6_addr, it also tries to display the
9 scope id, which is uninitialized when called from ife_print6.
10
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 ---
13
14 --- a/networking/interface.c
15 +++ b/networking/interface.c
16 @@ -881,6 +881,7 @@ static void ife_print6(struct interface
17 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
18 addr6p[0], addr6p[1], addr6p[2], addr6p[3],
19 addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
20 + memset(&sap, 0, sizeof(sap));
21 inet_pton(AF_INET6, addr6,
22 (struct sockaddr *) &sap.sin6_addr);
23 sap.sin6_family = AF_INET6;