From c9ba4f7b25ec65c1aba9ca25cfd5978e43d00fba Mon Sep 17 00:00:00 2001 From: emax Date: Wed, 18 Jul 2012 15:52:09 +0000 Subject: [PATCH] Return zero from get_addrselectpolicy() when no source-address-selection policy is installed. MFC after: 1 week --- lib/libc/net/getaddrinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index d6feb71cba49..d11ff780d8bb 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -692,6 +692,8 @@ get_addrselectpolicy(struct policyhead *head) if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) return (0); + if (l == 0) + return (0); if ((buf = malloc(l)) == NULL) return (0); if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {