]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/cache/knot_pkt.c: replace asserts
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 24 Mar 2021 16:44:44 +0000 (17:44 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 25 May 2021 12:39:40 +0000 (14:39 +0200)
lib/cache/knot_pkt.c

index d913c5d997bd7f1544d0e19832cda5351958c32c..b7b97c91ef746f56ca8ca95bc770c8cb34be6ede 100644 (file)
@@ -64,7 +64,8 @@ int pkt_append(knot_pkt_t *pkt, const struct answer_rrset *rrset, uint8_t rank)
        /* write both sets */
        const knot_rdataset_t *rdss[2] = { &rrset->set.rr->rrs, &rrset->sig_rds };
        for (int i = 0; i < rrset_cnt; ++i) {
-               assert(rdss[i]->count);
+               if (!kr_assume(rdss[i]->count))
+                       return kr_error(EINVAL);
                /* allocate rank */
                uint8_t *rr_rank = mm_alloc(&pkt->mm, sizeof(*rr_rank));
                if (!rr_rank) return kr_error(ENOMEM);