diff options
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/Banner | 2 | ||||
-rw-r--r-- | resolv/inet_net_pton.c | 18 | ||||
-rw-r--r-- | resolv/res_debug.c | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/resolv/Banner b/resolv/Banner index 5d0dc48e95..0cf0de3f6f 100644 --- a/resolv/Banner +++ b/resolv/Banner @@ -1 +1 @@ -BIND-4.9.5-T6B +BIND-4.9.5-REL diff --git a/resolv/inet_net_pton.c b/resolv/inet_net_pton.c index 7c863492d7..bf6fe02ed8 100644 --- a/resolv/inet_net_pton.c +++ b/resolv/inet_net_pton.c @@ -97,9 +97,7 @@ inet_net_pton_ipv4(src, dst, size) int n, ch, tmp, dirty, bits; const u_char *odst = dst; - bits = -1; ch = *src++; - if (ch == '0' && (src[0] == 'x' || src[0] == 'X') && isascii(src[1]) && isxdigit(src[1])) { /* Hexadecimal: Eat nybble string. */ @@ -150,6 +148,7 @@ inet_net_pton_ipv4(src, dst, size) } else goto enoent; + bits = -1; if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { /* CIDR width specifier. Nothing can follow it. */ ch = *src++; /* Skip over the /. */ @@ -163,6 +162,8 @@ inet_net_pton_ipv4(src, dst, size) isascii(ch) && isdigit(ch)); if (ch != '\0') goto enoent; + if (bits > 32) + goto emsgsize; } /* Firey death and destruction unless we prefetched EOS. */ @@ -174,14 +175,19 @@ inet_net_pton_ipv4(src, dst, size) goto enoent; /* If no CIDR spec was given, infer width from net class. */ if (bits == -1) { - if (*odst >= 224) + if (*odst >= 240) /* Class E */ + bits = 32; + else if (*odst >= 224) /* Class D */ bits = 4; - else if (*odst >= 192) + else if (*odst >= 192) /* Class C */ bits = 24; - else if (*odst >= 128) + else if (*odst >= 128) /* Class B */ bits = 16; - else + else /* Class A */ bits = 8; + /* If imputed mask is narrower than specified octets, widen. */ + if (bits >= 8 && bits < ((dst - odst) * 8)) + bits = (dst - odst) * 8; } /* Extend network to cover the actual mask. */ while (bits > ((dst - odst) * 8)) { diff --git a/resolv/res_debug.c b/resolv/res_debug.c index 49eef72cd2..8fb4bcf33f 100644 --- a/resolv/res_debug.c +++ b/resolv/res_debug.c @@ -295,7 +295,7 @@ __fp_nquery(msg, len, file) */ hp = (HEADER *)msg; cp = msg + HFIXEDSZ; - endMark = cp + len; + endMark = msg + len; if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || hp->rcode) { fprintf(file, ";; ->>HEADER<<- opcode: %s, status: %s, id: %d", _res_opcodes[hp->opcode], |