]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DNS: Do not leak RR data upon RR data unpacking errors (#2193)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Tue, 9 Sep 2025 01:14:06 +0000 (01:14 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 9 Sep 2025 01:14:15 +0000 (01:14 +0000)
src/dns/rfc1035.cc

index 53cfced6c6637ea2f34f054f2b0777788b5b52d0..e16b4f8650c1c258e913713f8c6a3b007b6f19cd 100644 (file)
@@ -420,6 +420,8 @@ rfc1035RRUnpack(const char *buf, size_t sz, unsigned int *off, rfc1035_rr * RR)
         RR->rdlength = 0;   /* Filled in by rfc1035NameUnpack */
         if (rfc1035NameUnpack(buf, sz, &rdata_off, &RR->rdlength, RR->rdata, RFC1035_MAXHOSTNAMESZ, 0)) {
             RFC1035_UNPACK_DEBUG;
+            xfree(RR->rdata);
+            memset(RR, '\0', sizeof(*RR));
             return 1;
         }
         if (rdata_off > ((*off) + rdlength)) {