diff options
author | Stefan Bühler <stbuehler@web.de> | 2010-12-18 14:17:09 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-12-18 17:23:04 +0100 |
commit | 70b726c3343f83d7d3460dce0b24e8930c6f6195 (patch) | |
tree | 2089ffd8ac2664d4297816f07da269332cb0ea46 /ares_expand_name.c | |
parent | a44f4c33e9d3547920a91d904477835c18ce05f9 (diff) | |
download | c-ares-70b726c3343f83d7d3460dce0b24e8930c6f6195.tar.gz c-ares-70b726c3343f83d7d3460dce0b24e8930c6f6195.tar.bz2 c-ares-70b726c3343f83d7d3460dce0b24e8930c6f6195.zip |
ares_expand_name: Fix encoded length for indirect root
Diffstat (limited to 'ares_expand_name.c')
-rw-r--r-- | ares_expand_name.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ares_expand_name.c b/ares_expand_name.c index 2af6b2a..e3eccd2 100644 --- a/ares_expand_name.c +++ b/ares_expand_name.c @@ -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; } |