|
Message-Id: <1392134773-7227-1-git-send-email-clement.vasseur@gmail.com> Date: Tue, 11 Feb 2014 17:06:13 +0100 From: Clément Vasseur <clement.vasseur@...il.com> To: musl@...ts.openwall.com Subject: [PATCH] getaddrinfo: fix service lookup without proto hint Only enable the service protocol check if a protocol has been specified. Otherwise, getaddrinfo(NULL, "tftp", NULL, &res) would return the EAI_SERVICE error code because the protocol check was performed even though no protocol was specified at all. --- src/network/getaddrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index 5d45be7..57c53fd 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -88,7 +88,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru if (strncmp(line, serv, servlen) || !isspace(line[servlen])) continue; port = strtoul(line+servlen, &end, 10); - if (strncmp(end, proto==IPPROTO_UDP ? "/udp" : "/tcp", 4)) + if (proto && strncmp(end, proto==IPPROTO_UDP ? "/udp" : "/tcp", 4)) continue; break; } -- 1.8.5.3
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.