aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_parse_a_reply.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-01-11 13:49:13 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-01-11 13:49:13 +0000
commit32b75d1b6995653a4f1131aaa7e4c23b9946047e (patch)
treefb92246b61bbaf1158d0da993bfc9642883c6c09 /ares/ares_parse_a_reply.c
parentf7e3bd28b4347cd111f2a77be4543c44664ac8f5 (diff)
- Phil Blundell added the internal function ares__expand_name_for_response()
that is now used by the ares_parse_*_reply() functions instead of the ares_expand_name() simply to easier return ARES_EBADRESP for the cases where the name expansion fails as in responses that really isn't expected.
Diffstat (limited to 'ares/ares_parse_a_reply.c')
-rw-r--r--ares/ares_parse_a_reply.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ares/ares_parse_a_reply.c b/ares/ares_parse_a_reply.c
index 6380f5bac..b8d98d43c 100644
--- a/ares/ares_parse_a_reply.c
+++ b/ares/ares_parse_a_reply.c
@@ -83,7 +83,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
- status = ares_expand_name(aptr, abuf, alen, &hostname, &len);
+ status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
@@ -95,7 +95,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
if (host)
{
- /* Allocate addresses and aliases; ancount gives an upper bound for both. */
+ /* Allocate addresses and aliases; ancount gives an upper bound for
+ both. */
addrs = malloc(ancount * sizeof(struct in_addr));
if (!addrs)
{
@@ -115,7 +116,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
addrs = NULL;
aliases = NULL;
}
-
+
naddrs = 0;
naliases = 0;
@@ -123,7 +124,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
- status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
+ status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
@@ -176,7 +177,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
naliases++;
/* Decode the RR data and replace the hostname with it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
+ &len);
if (status != ARES_SUCCESS)
break;
free(hostname);