summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2015-01-30 16:41:43 +0000
committergilles <gilles@openbsd.org>2015-01-30 16:41:43 +0000
commit0203ec73a9d17e8015e9eacb07cfe3d1e515e0f3 (patch)
tree3d63c562fd977fc03223521bb0396976797a2e41
parentTidy up detach-client a bit. (diff)
downloadwireguard-openbsd-0203ec73a9d17e8015e9eacb07cfe3d1e515e0f3.tar.xz
wireguard-openbsd-0203ec73a9d17e8015e9eacb07cfe3d1e515e0f3.zip
fix a possible NULL-deref when trying to deref ifa->ifa_addr
ok eric@
-rw-r--r--lib/libc/asr/getaddrinfo_async.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c
index 162759f80de..0b8b5e71fee 100644
--- a/lib/libc/asr/getaddrinfo_async.c
+++ b/lib/libc/asr/getaddrinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo_async.c,v 1.32 2015/01/14 23:36:15 deraadt Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.33 2015/01/30 16:41:43 gilles Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -218,6 +218,8 @@ getaddrinfo_async_run(struct asr_query *as, struct asr_result *ar)
for (ifa = ifa0; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa->ifa_flags & IFF_LOOPBACK)
continue;
+ if (ifa->ifa_addr == NULL)
+ continue;
if (ifa->ifa_addr->sa_family == PF_INET)
v4 = 1;
else if (ifa->ifa_addr->sa_family == PF_INET6 &&