[SSSD] [PATCH] RESOLV: return ENOENT if the address list is empty
Jakub Hrozek
jhrozek at redhat.com
Sun Dec 2 20:57:25 UTC 2012
This is a more generic variant of the patch Stephen sent to protect
against crashes during the dynamic DNS update. I think we can also do
the same in the resolver which would protect all resolver consumers.
-------------- next part --------------
>From 093ab86b49bffd59fb687a79cf4ae211101d03ca Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Sun, 2 Dec 2012 21:53:31 +0100
Subject: [PATCH] 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 81adf098a7c5cf8d47ab549ea0ee14b36e7898e3..00aed1434d2cbaf3e43d8cf54742180ab1a3f9fd 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);
--
1.8.0.1
More information about the sssd-devel
mailing list