git: 2fb377976493 - stable/13 - ipfilter: Fix ip_nat memory leak and use-after-free

Cy Schubert cy at FreeBSD.org
Thu Jun 3 00:55:46 UTC 2021


The branch stable/13 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=2fb377976493cd961dfe1908d1c565742e79bb4a

commit 2fb377976493cd961dfe1908d1c565742e79bb4a
Author:     Cy Schubert <cy at FreeBSD.org>
AuthorDate: 2021-05-25 18:54:49 +0000
Commit:     Cy Schubert <cy at FreeBSD.org>
CommitDate: 2021-06-03 00:54:30 +0000

    ipfilter: Fix ip_nat memory leak and use-after-free
    
    Unfortunately the wrong elemet is freed, also resulting in use-after-free.
    
    PR:             255859
    Submitted by:   lylgood at foxmail.com
    Reported by:    lylgood at foxmail.com
    
    (cherry picked from commit 323a4e2c4e285e6f8eee8db3fe2cb7490a734da0)
---
 sys/contrib/ipfilter/netinet/ip_nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c
index 084c79bbee9a..6b48543d6119 100644
--- a/sys/contrib/ipfilter/netinet/ip_nat.c
+++ b/sys/contrib/ipfilter/netinet/ip_nat.c
@@ -6243,7 +6243,7 @@ ipf_nat_rule_deref(softc, inp)
 
 	if (n->in_tqehead[0] != NULL) {
 		if (ipf_deletetimeoutqueue(n->in_tqehead[0]) == 0) {
-			ipf_freetimeoutqueue(softc, n->in_tqehead[1]);
+			ipf_freetimeoutqueue(softc, n->in_tqehead[0]);
 		}
 	}
 


More information about the dev-commits-src-all mailing list