summaryrefslogtreecommitdiff
path: root/libc/inet/resolv.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-10 06:26:14 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-10 06:26:14 +0000
commit91489217d4d0061798b03b1299e4e1a434cf4c72 (patch)
tree4aea66b7fa35caa0b020cb35775bbc9edbcb8265 /libc/inet/resolv.c
parent18689d59bbbb606d71ecbabc413cdca1bf64b297 (diff)
Patch from Jay Kulpinski:
__decode_dotted() does not count the null terminating byte of a hostname in the DNS response. This causes lookups to fail if the DNS response doesn't compress domain names in the message.
Diffstat (limited to 'libc/inet/resolv.c')
-rw-r--r--libc/inet/resolv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 0cc344399..ca8f4c7ba 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -50,6 +50,11 @@
* allocation accordingly. See MAX_ALIASES and ALIAS_DIM below.
* This fixes the segfault in the Python 2.2.1 socket test.
*
+ * 04-Jan-2003 Jay Kulpinski <jskulpin@berkshire.rr.com>
+ * Fixed __decode_dotted to count the terminating null character
+ * in a host name.
+ *
+ *
*/
#define __FORCE_GLIBC
@@ -307,6 +312,11 @@ int __decode_dotted(const unsigned char *data, int offset,
dest[used++] = '\0';
}
+ /* The null byte must be counted too */
+ if (measure) {
+ total++;
+ }
+
DPRINTF("Total decode len = %d\n", total);
return total;