010-networking-fix-uninitialized-memory-when-displaying-.patch 873 B

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