]> 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)
committerFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Tue, 9 Sep 2025 09:20:58 +0000 (10:20 +0100)
src/dns/rfc1035.cc

index 5e31741d0b8c99a98c4736cb1885b49e27d0999a..c17f288e3eb5ae4b8254695be350b161e0c9522d 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)) {