From: W.C.A. Wijngaards Date: Tue, 16 Jun 2026 08:59:37 +0000 (+0200) Subject: - Fix after malloc failure the rrset_insert_rr in X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ab75c004326efc7d06c6b1da22fcada62f9fda6;p=thirdparty%2Funbound.git - Fix after malloc failure the rrset_insert_rr in localzone processing, during RPZ qname trigger processing, the RRset retains its previous data correcly. Thanks to Qifan Zhang, Palo Alto Networks, for the report. --- diff --git a/doc/Changelog b/doc/Changelog index a20fbc534..de4c07760 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -56,6 +56,10 @@ - Fix incorrect cleanup after an allocation failure for a delegation point in a region. Thanks to Qifan Zhang, Palo Alto Networks, for the report. + - Fix after malloc failure the rrset_insert_rr in + localzone processing, during RPZ qname trigger processing, + the RRset retains its previous data correcly. Thanks to + Qifan Zhang, Palo Alto Networks, for the report. 15 June 2026: Wouter - Fix to add `max-transfer-size` and `max-transfer-time` that diff --git a/services/localzone.c b/services/localzone.c index 8eebd962a..7ad9376a9 100644 --- a/services/localzone.c +++ b/services/localzone.c @@ -431,6 +431,10 @@ rrset_insert_rr(struct regional* region, struct packed_rrset_data* pd, pd->rr_ttl = regional_alloc(region, sizeof(*pd->rr_ttl)*pd->count); pd->rr_data = regional_alloc(region, sizeof(*pd->rr_data)*pd->count); if(!pd->rr_len || !pd->rr_ttl || !pd->rr_data) { + pd->count--; + pd->rr_len = oldlen; + pd->rr_ttl = oldttl; + pd->rr_data = olddata; log_err("out of memory"); return 0; } @@ -446,6 +450,10 @@ rrset_insert_rr(struct regional* region, struct packed_rrset_data* pd, pd->rr_ttl[0] = ttl; pd->rr_data[0] = regional_alloc_init(region, rdata, rdata_len); if(!pd->rr_data[0]) { + pd->count--; + pd->rr_len = oldlen; + pd->rr_ttl = oldttl; + pd->rr_data = olddata; log_err("out of memory"); return 0; }