From ba21e214bdeca1e6bc92b6d768b21f00fc2ac971 Mon Sep 17 00:00:00 2001 From: ume Date: Wed, 27 Dec 2017 14:50:07 +0000 Subject: [PATCH] MFC r327029: Don't ignore trailing spaces after numerical IP addresses. PR: 224403 git-svn-id: svn://svn.freebsd.org/base/stable/10@327238 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libc/net/getaddrinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 163241bed..211bbd0ed 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -1243,7 +1243,8 @@ explore_numeric(const struct addrinfo *pai, const char *hostname, * does not accept. So we need to separate the case for * AF_INET. */ - if (inet_aton(hostname, (struct in_addr *)pton) != 1) + if (inet_aton(hostname, (struct in_addr *)pton) != 1 || + hostname[strspn(hostname, "0123456789.xabcdefXABCDEF")] != '\0') return 0; break; default: -- 2.42.0