1
0
mirror of https://frontier.innolan.net/rainlance/c-ares.git synced 2025-10-06 03:09:40 +00:00

Handle the root of the DNS tree correctly in ares_expand_name.

This commit is contained in:
Steinar H. Gunderson
2007-09-29 13:38:17 +00:00
parent c577d2455e
commit 49162e5b67

View File

@ -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)