diff options
author | Steinar H. Gunderson <sesse@google.com> | 2007-09-29 13:38:17 +0000 |
---|---|---|
committer | Steinar H. Gunderson <sesse@google.com> | 2007-09-29 13:38:17 +0000 |
commit | 49162e5b67d5b27cce4f364c540b0b8b5a18f6ff (patch) | |
tree | 6ca4397497bbc00cc598672935105998b3599e52 /ares_expand_name.c | |
parent | c577d2455e30da16a1e5b5d2289ec77d9d89dc1f (diff) | |
download | c-ares-49162e5b67d5b27cce4f364c540b0b8b5a18f6ff.tar.gz c-ares-49162e5b67d5b27cce4f364c540b0b8b5a18f6ff.tar.bz2 c-ares-49162e5b67d5b27cce4f364c540b0b8b5a18f6ff.zip |
Handle the root of the DNS tree correctly in ares_expand_name.
Diffstat (limited to 'ares_expand_name.c')
-rw-r--r-- | ares_expand_name.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ares_expand_name.c b/ares_expand_name.c index 7fe025f..ffa26e6 100644 --- a/ares_expand_name.c +++ b/ares_expand_name.c @@ -74,6 +74,14 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, return ARES_ENOMEM; q = *s; + if (len == 0) { + // RFC2181 says this should be ".": the root of the DNS tree. + // Since this function strips trailing dots though, it becomes "" + q[0] = '\0'; + *enclen = 1; // the caller should move one byte to get past this + return ARES_SUCCESS; + } + /* No error-checking necessary; it was all done by name_length(). */ p = encoded; while (*p) |