From d803ac93dc8a48dcd8a4d97f3e90767a3512d3d3 Mon Sep 17 00:00:00 2001 From: thorkill Date: Tue, 30 Jun 2015 19:23:15 +0200 Subject: [PATCH] Initialize variables in netutl.c --- src/netutl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/netutl.c b/src/netutl.c index 2eebb644..fab3fc78 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -33,9 +33,11 @@ bool hostnames = false; Return NULL on failure. */ struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) { - struct addrinfo *ai, hint = {0}; + struct addrinfo *ai, hint; int err; + memset(&hint, 0x0, sizeof(struct addrinfo)); + hint.ai_family = addressfamily; hint.ai_socktype = socktype; @@ -53,10 +55,13 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock } sockaddr_t str2sockaddr(const char *address, const char *port) { - struct addrinfo *ai, hint = {0}; - sockaddr_t result = {{0}}; + struct addrinfo *ai, hint; + sockaddr_t result; int err; + memset(&hint, 0x0, sizeof(struct addrinfo)); + memset(&result, 0x0, sizeof(sockaddr_t)); + hint.ai_family = AF_UNSPEC; hint.ai_flags = AI_NUMERICHOST; hint.ai_socktype = SOCK_STREAM;