diff options
author | 2014-11-02 13:59:16 +0000 | |
---|---|---|
committer | 2014-11-02 13:59:16 +0000 | |
commit | 0d7b84a898f082aed9d1f2ec3ae7c476483a8f40 (patch) | |
tree | 10566e59b2ec8d795587185aa26d7c4c6c50670f /lib/libc/asr/gethostnamadr_async.c | |
parent | use nanosleep() instead of select(); ok jsing (diff) | |
download | wireguard-openbsd-0d7b84a898f082aed9d1f2ec3ae7c476483a8f40.tar.xz wireguard-openbsd-0d7b84a898f082aed9d1f2ec3ae7c476483a8f40.zip |
Fix a NULL deref when getting an actual result for an invalid hostname
in gethostbyname(). Similar fix for getnetbyname().
ok deraadt@ daniel@ jca@
Diffstat (limited to 'lib/libc/asr/gethostnamadr_async.c')
-rw-r--r-- | lib/libc/asr/gethostnamadr_async.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c index 82614f29cde..7d78e2bf2d0 100644 --- a/lib/libc/asr/gethostnamadr_async.c +++ b/lib/libc/asr/gethostnamadr_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gethostnamadr_async.c,v 1.31 2014/09/15 06:15:48 guenther Exp $ */ +/* $OpenBSD: gethostnamadr_async.c,v 1.32 2014/11/02 13:59:16 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -357,13 +357,12 @@ gethostnamadr_async_run(struct asr_query *as, struct asr_result *ar) } /* - * No address found in the dns packet. The blocking version - * reports this as an error. + * No valid hostname or address found in the dns packet. + * Ignore it. */ if ((as->as_type == ASR_GETHOSTBYNAME && h->h.h_addr_list[0] == NULL) || - (as->as_type == ASR_GETHOSTBYADDR && - h->h.h_name == NULL)) { + h->h.h_name == NULL) { free(h); async_set_state(as, ASR_STATE_NEXT_DB); break; |