summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2015-01-30 16:41:44 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2015-01-30 16:41:44 +0000
commitc172c1babcbfda1c356956295775be16fd469cf1 (patch)
tree4dec3f41f3054b815e1e999a11658b570778a1ea /lib
parent0afc3e6e67cbd8ecf3cf6702cc1d179fa66b7666 (diff)
fix a possible NULL-deref when trying to deref ifa->ifa_addr
ok eric@
Diffstat (limited to 'lib')
-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 &&