From a0102eed6cdd894fd2b079cfae006e0a62f94777 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 2 Dec 2012 21:53:31 +0100 Subject: RESOLV: return ENOENT if the address list is empty --- src/resolv/async_resolv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c index 81adf098a..00aed1434 100644 --- a/src/resolv/async_resolv.c +++ b/src/resolv/async_resolv.c @@ -1046,6 +1046,14 @@ resolv_gethostbyname_dns_parse(struct gethostbyname_dns_state *state, ret = ENOMEM; goto fail; } + + /* The address list is NULL. This is probably a bug in + * c-ares, but we need to handle it gracefully. + */ + if (state->rhostent->addr_list == NULL) { + talloc_free(state->rhostent); + return ENOENT; + } } talloc_free(tmp_ctx); -- cgit