summaryrefslogtreecommitdiff
path: root/ares_expand_name.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
commit8362245c42883bf5775d87d2d996b89b6f2f2fed (patch)
treef1c521d433f43de18eb8614b0e7180ae9c68cf95 /ares_expand_name.c
parentbcb85d35df7e1f9144f6256d6ec5f61a93dcc86d (diff)
downloadc-ares-8362245c42883bf5775d87d2d996b89b6f2f2fed.tar.gz
c-ares-8362245c42883bf5775d87d2d996b89b6f2f2fed.tar.bz2
c-ares-8362245c42883bf5775d87d2d996b89b6f2f2fed.zip
- 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_expand_name.c')
-rw-r--r--ares_expand_name.c11
1 files changed, 11 insertions, 0 deletions
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;
+}