Skip to content

Commit

Permalink
ares_expand_name: Fix encoded length for indirect root
Browse files Browse the repository at this point in the history
  • Loading branch information
stbuehler authored and bagder committed Dec 18, 2010
1 parent a44f4c3 commit 70b726c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ares_expand_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 70b726c

Please sign in to comment.