fix regression in dn_expand/reverse dns
authorRich Felker <dalias@aerifal.cx>
Sat, 24 Aug 2013 01:25:01 +0000 (21:25 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 24 Aug 2013 01:25:01 +0000 (21:25 -0400)
off-by-one error copying the name components was yielding junk at the
beginning and truncating one character at the end (of every
component).

src/network/dn_expand.c

index f817d059ae9c43bdaecb7fdddbbedd740af613b3..4e02e3d27382b449185da382b8bb0be6e112d2ad 100644 (file)
@@ -17,7 +17,7 @@ int __dn_expand(const unsigned char *base, const unsigned char *end, const unsig
                } else if (*p) {
                        j = *p+1;
                        if (j>=end-p || j>space) return -1;
-                       while (--j) *dest++ = *p++;
+                       while (--j) *dest++ = *++p;
                        *dest++ = *++p ? '.' : 0;
                } else {
                        if (len < 0) len = p+1-src;