From 2c63440127feed70ccefb148b8f938a2df6c15f8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 2 Dec 2010 10:47:50 +0100 Subject: [PATCH] ares_parse_a_reply: fix CNAME response parsing Reply to a CNAME query doesn't contain addresses, causing ares_parse_a_reply() to bail out with ARES_ENODATA Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b --- ares_parse_a_reply.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ares_parse_a_reply.c b/ares_parse_a_reply.c index 86112d7..9301254 100644 --- a/ares_parse_a_reply.c +++ b/ares_parse_a_reply.c @@ -201,7 +201,9 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, } } - if (status == ARES_SUCCESS && naddrs == 0) + if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0) + /* the check for naliases to be zero is to make sure CNAME responses + don't get caught here */ status = ARES_ENODATA; if (status == ARES_SUCCESS) { -- 2.7.4