1
0
mirror of https://frontier.innolan.net/rainlance/c-ares.git synced 2025-10-05 18:30:31 +00:00

ares_expand_name: Fix encoded length for indirect root

This commit is contained in:
Stefan Bühler
2010-12-18 14:17:09 +01:00
committed by Daniel Stenberg
parent a44f4c33e9
commit 70b726c334

View File

@ -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;
}