From 8362245c42883bf5775d87d2d996b89b6f2f2fed Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 11 Jan 2009 13:49:13 +0000 Subject: - 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. --- ares_expand_name.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ares_expand_name.c') diff --git a/ares_expand_name.c b/ares_expand_name.c index 8a9d822..b0af474 100644 --- a/ares_expand_name.c +++ b/ares_expand_name.c @@ -177,3 +177,14 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, */ return (n) ? n - 1 : n; } + +/* Like ares_expand_name but returns EBADRESP in case of invalid input. */ +int ares__expand_name_for_response(const unsigned char *encoded, + const unsigned char *abuf, int alen, + char **s, long *enclen) +{ + int status = ares_expand_name(encoded, abuf, alen, s, enclen); + if (status == ARES_EBADNAME) + status = ARES_EBADRESP; + return status; +} -- cgit v1.2.3