From: Mark Andrews Date: Tue, 12 Mar 2024 23:15:03 +0000 (+1100) Subject: Only call memmove if the rdata length is non zero X-Git-Tag: v9.18.26~29^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=3fadd9efec6d0d5b447f26142eef1b2fd9c1bb25;p=thirdparty%2Fbind9.git Only call memmove if the rdata length is non zero This avoids undefined behaviour on zero length rdata where the data pointer is NULL. (cherry picked from commit 228cc557fe4ca29e34eccb3a1846d7f754879aed) --- diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index 24fdaa83a19..2b4cc4bed3f 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -320,7 +320,9 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, ? DNS_RDATASLAB_OFFLINE : 0; } - memmove(rawbuf, x[i].rdata.data, x[i].rdata.length); + if (x[i].rdata.length != 0) { + memmove(rawbuf, x[i].rdata.data, x[i].rdata.length); + } rawbuf += x[i].rdata.length; }