getaddrinfo: zero the hints structure
authorEmilia Kasper <emilia@openssl.org>
Fri, 19 Feb 2016 15:23:08 +0000 (16:23 +0100)
committerEmilia Kasper <emilia@openssl.org>
Fri, 19 Feb 2016 15:44:28 +0000 (16:44 +0100)
This silences the memory sanitizer. All fields were already correctly
initialized but the struct padding wasn't, causing an uninitialized read
warning.

Reviewed-by: Tim Hudson <tjh@openssl.org>
crypto/bio/b_addr.c

index a46cf93786505b3eb336f2c874265dce6f843576..6125e86124cfa660e75a0c255fccf1242eb64703 100644 (file)
@@ -681,18 +681,13 @@ int BIO_lookup(const char *host, const char *service,
         int gai_ret = 0;
 #ifdef AI_PASSIVE
         struct addrinfo hints;
+        memset(&hints, 0, sizeof hints);
 
-        hints.ai_flags = 0;
 # ifdef AI_ADDRCONFIG
         hints.ai_flags = AI_ADDRCONFIG;
 # endif
         hints.ai_family = family;
         hints.ai_socktype = socktype;
-        hints.ai_protocol = 0;
-        hints.ai_addrlen = 0;
-        hints.ai_addr = NULL;
-        hints.ai_canonname = NULL;
-        hints.ai_next = NULL;
 
         if (lookup_type == BIO_LOOKUP_SERVER)
             hints.ai_flags |= AI_PASSIVE;