Permalink
Browse files

ares_expand_name: Fix encoded length for indirect root

  • Loading branch information...
stbuehler authored and bagder committed Dec 18, 2010
1 parent a44f4c3 commit 70b726c3343f83d7d3460dce0b24e8930c6f6195
Showing with 8 additions and 1 deletion.
  1. +8 −1 ares_expand_name.c
View
@@ -87,7 +87,14 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* Since this function strips trailing dots though, it becomes ""
*/
q[0] = '\0';
- *enclen = 1; /* the caller should move one byte to get past this */
+
+ /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
+ valid) */
+ if ((*encoded & INDIR_MASK) == INDIR_MASK)
+ *enclen = 2;
+ else
+ *enclen = 1; /* the caller should move one byte to get past this */
+
return ARES_SUCCESS;
}

0 comments on commit 70b726c

Please sign in to comment.