mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2025-10-05 20:19:32 +00:00
- 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.
This commit is contained in:
@ -73,7 +73,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
|
||||
/* Expand the name from the question, and skip past the question. */
|
||||
aptr = abuf + HFIXEDSZ;
|
||||
status = ares_expand_name(aptr, abuf, alen, &ptrname, &len);
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len);
|
||||
if (status != ARES_SUCCESS)
|
||||
return status;
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen)
|
||||
@ -94,7 +94,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
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;
|
||||
@ -112,7 +112,8 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
&& strcasecmp(rr_name, ptrname) == 0)
|
||||
{
|
||||
/* Decode the RR data and set hostname to 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;
|
||||
if (hostname)
|
||||
@ -141,7 +142,8 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
||||
{
|
||||
/* Decode the RR data and replace ptrname 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(ptrname);
|
||||
|
Reference in New Issue
Block a user