mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
1075. [bug] Out-of-range network prefix lengths were not
reported. [RT #1954]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
1075. [bug] Out-of-range network prefix lengths were not
|
||||||
|
reported. [RT #1954]
|
||||||
|
|
||||||
1074. [bug] Running out of memory in dump_rdataset() could
|
1074. [bug] Running out of memory in dump_rdataset() could
|
||||||
cause an assertion failure. [RT #1946]
|
cause an assertion failure. [RT #1946]
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: parser.c,v 1.84 2001/10/25 04:57:46 marka Exp $ */
|
/* $Id: parser.c,v 1.85 2001/10/26 19:35:03 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -3002,10 +3002,22 @@ parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
|
|||||||
cfg_obj_t *obj = NULL;
|
cfg_obj_t *obj = NULL;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_netaddr_t netaddr;
|
isc_netaddr_t netaddr;
|
||||||
unsigned int prefixlen;
|
unsigned int addrlen, prefixlen;
|
||||||
UNUSED(type);
|
UNUSED(type);
|
||||||
|
|
||||||
CHECK(get_addr(pctx, V4OK|V4PREFIXOK|V6OK, &netaddr));
|
CHECK(get_addr(pctx, V4OK|V4PREFIXOK|V6OK, &netaddr));
|
||||||
|
switch (netaddr.family) {
|
||||||
|
case AF_INET:
|
||||||
|
addrlen = 32;
|
||||||
|
break;
|
||||||
|
case AF_INET6:
|
||||||
|
addrlen = 128;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
addrlen = 0;
|
||||||
|
INSIST(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
CHECK(cfg_peektoken(pctx, 0));
|
CHECK(cfg_peektoken(pctx, 0));
|
||||||
if (pctx->token.type == isc_tokentype_special &&
|
if (pctx->token.type == isc_tokentype_special &&
|
||||||
pctx->token.value.as_char == '/') {
|
pctx->token.value.as_char == '/') {
|
||||||
@@ -3017,19 +3029,13 @@ parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
|
|||||||
return (ISC_R_UNEXPECTEDTOKEN);
|
return (ISC_R_UNEXPECTEDTOKEN);
|
||||||
}
|
}
|
||||||
prefixlen = pctx->token.value.as_ulong;
|
prefixlen = pctx->token.value.as_ulong;
|
||||||
} else {
|
if (prefixlen > addrlen) {
|
||||||
switch (netaddr.family) {
|
parser_error(pctx, LOG_NOPREP,
|
||||||
case AF_INET:
|
"invalid prefix length");
|
||||||
prefixlen = 32;
|
return (ISC_R_RANGE);
|
||||||
break;
|
|
||||||
case AF_INET6:
|
|
||||||
prefixlen = 128;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
prefixlen = 0;
|
|
||||||
INSIST(0);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
prefixlen = addrlen;
|
||||||
}
|
}
|
||||||
CHECK(create_cfgobj(pctx, &cfg_type_netprefix, &obj));
|
CHECK(create_cfgobj(pctx, &cfg_type_netprefix, &obj));
|
||||||
obj->value.netprefix.address = netaddr;
|
obj->value.netprefix.address = netaddr;
|
||||||
|
Reference in New Issue
Block a user