Fixed compression pointer processing in DNS response greater than 255 bytes.

Thanks to Ben Hawkes.
This commit is contained in:
Igor Sysoev 2011-11-09 13:54:07 +00:00
parent a1f95cd5d6
commit 6cc6ee5f71

View file

@ -1952,7 +1952,13 @@ done:
n = *src++;
for ( ;; ) {
if (n != 0xc0) {
if (n & 0xc0) {
n = ((n & 0x3f) << 8) + *src;
src = &buf[n];
n = *src++;
} else {
ngx_memcpy(dst, src, n);
dst += n;
src += n;
@ -1962,12 +1968,6 @@ done:
if (n != 0) {
*dst++ = '.';
}
} else {
n = ((n & 0x3f) << 8) + *src;
src = &buf[n];
n = *src++;
}
if (n == 0) {