From 63128eead92c4e07559b222e2d3d0999be8c82ff Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 21 Apr 2017 22:04:09 +0200 Subject: [PATCH] net: Always initialize struct sockaddr_storage. The static analyzer of clang claims that the left operand of the condition ss->ss_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&ia6->sin6_addr); in SS_IS_ADDR_V4MAPPED() is a garbage value. The code has been like this for seven years without problems, so the warning is probably bogus. It does not hurt to initialize the sockaddr_storage structures though, which silences the warning. --- net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net.c b/net.c index fa7cd4b8..eaa1cfb8 100644 --- a/net.c +++ b/net.c @@ -603,7 +603,7 @@ static inline int estimated_header_overhead(const int af_type) */ int generic_max_transport_msg_size(int sockfd) { - struct sockaddr_storage ss; + struct sockaddr_storage ss = {0}; socklen_t sslen = sizeof(ss); int af_type = AF_INET; @@ -629,7 +629,7 @@ int generic_max_transport_msg_size(int sockfd) */ char *remote_name(int fd) { - struct sockaddr_storage ss; + struct sockaddr_storage ss = {0}; const struct sockaddr *sa; socklen_t sslen = sizeof(ss); char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; -- 2.39.2