From: Mark Andrews Date: Mon, 21 Feb 2011 06:07:49 +0000 (+0000) Subject: 3027. [bug] Add documented REQUIREs to cfg_obj_asnetprefix() to X-Git-Tag: v9.7.3-P1~2^4~36 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=30aaec21221ca5d8715d1ff1ce92fbdf98bb6652;p=thirdparty%2Fbind9.git 3027. [bug] Add documented REQUIREs to cfg_obj_asnetprefix() to catch NULL pointer dereferences before they happen. [RT #22521] --- diff --git a/CHANGES b/CHANGES index 3368f4c428b..05f3e725c0a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3027. [bug] Add documented REQUIREs to cfg_obj_asnetprefix() to + catch NULL pointer dereferences before they happen. + [RT #22521] + 3026. [bug] lib/isc/httpd.c: check that we have enough space after calling grow_headerspace() and if not re-call grow_headerspace() until we do. [RT #22521] diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 7db753e2cbb..70126fc9738 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.139 2011/01/04 23:47:14 tbox Exp $ */ +/* $Id: parser.c,v 1.140 2011/02/21 06:07:49 marka Exp $ */ /*! \file */ @@ -2006,8 +2006,12 @@ cfg_obj_isnetprefix(const cfg_obj_t *obj) { void cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr, - unsigned int *prefixlen) { + unsigned int *prefixlen) +{ REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_netprefix); + REQUIRE(netaddr != NULL); + REQUIRE(prefixlen != NULL); + *netaddr = obj->value.netprefix.address; *prefixlen = obj->value.netprefix.prefixlen; }