]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Silence Coverity FORWARD_NULL warning
authorMark Andrews <marka@isc.org>
Mon, 10 Feb 2020 20:52:24 +0000 (07:52 +1100)
committerMark Andrews <marka@isc.org>
Tue, 11 Feb 2020 13:02:08 +0000 (13:02 +0000)
CID 1458400 (#1 of 1): Dereference after null check
(FORWARD_NULL) 14. var_deref_model: Passing null pointer
nxt->typebits to mem_tobuffer, which dereferences it. [show
details]

219        return (mem_tobuffer(target, nxt->typebits, nxt->len));

lib/dns/rdata/generic/nxt_30.c

index c71f92622ee4230c37f99e242627056fb2f6f16b..2afc235045947dc3064c908e9b21a0561d013e75 100644 (file)
@@ -198,12 +198,10 @@ fromstruct_nxt(ARGS_FROMSTRUCT) {
 
        REQUIRE(type == dns_rdatatype_nxt);
        REQUIRE(((dns_rdata_nxt_t *)source) != NULL);
-       REQUIRE(((dns_rdata_nxt_t *)source)->common.rdtype == type);
-       REQUIRE(((dns_rdata_nxt_t *)source)->common.rdclass == rdclass);
-       REQUIRE(((dns_rdata_nxt_t *)source)->typebits != NULL ||
-               ((dns_rdata_nxt_t *)source)->len == 0);
-
        nxt = source;
+       REQUIRE(nxt->common.rdtype == type);
+       REQUIRE(nxt->common.rdclass == rdclass);
+       REQUIRE(nxt->typebits != NULL || nxt->len == 0);
 
        if (nxt->typebits != NULL && (nxt->typebits[0] & 0x80) == 0) {
                REQUIRE(nxt->len <= 16);