19a0061b6Sopenharmony_ciFrom e900d40afdb731d2270a5110833ae49192974355 Mon Sep 17 00:00:00 2001
29a0061b6Sopenharmony_ciFrom: Florian Westphal <fw@strlen.de>
39a0061b6Sopenharmony_ciDate: Tue, 14 Mar 2023 22:36:50 +0100
49a0061b6Sopenharmony_ciSubject: [PATCH] xtables-eb: fix crash when opts isn't reallocated
59a0061b6Sopenharmony_ci
69a0061b6Sopenharmony_ciopts may point to statically allocated memory.
79a0061b6Sopenharmony_ciThis fixes abort() from libc.
89a0061b6Sopenharmony_ci
99a0061b6Sopenharmony_ciConflict: NA
109a0061b6Sopenharmony_ciReference: https://git.netfilter.org/iptables/commit?id=e900d40afdb731d2270a5110833ae49192974355
119a0061b6Sopenharmony_ci
129a0061b6Sopenharmony_ciSigned-off-by: Florian Westphal <fw@strlen.de>
139a0061b6Sopenharmony_ci---
149a0061b6Sopenharmony_ci iptables/xtables-eb.c | 3 ++-
159a0061b6Sopenharmony_ci 1 file changed, 2 insertions(+), 1 deletion(-)
169a0061b6Sopenharmony_ci
179a0061b6Sopenharmony_cidiff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
189a0061b6Sopenharmony_ciindex 3a73e797..068dffd2 100644
199a0061b6Sopenharmony_ci--- a/iptables/xtables-eb.c
209a0061b6Sopenharmony_ci+++ b/iptables/xtables-eb.c
219a0061b6Sopenharmony_ci@@ -675,7 +675,8 @@ void nft_fini_eb(struct nft_handle *h)
229a0061b6Sopenharmony_ci 		free(target->t);
239a0061b6Sopenharmony_ci 	}
249a0061b6Sopenharmony_ci 
259a0061b6Sopenharmony_ci-	free(opts);
269a0061b6Sopenharmony_ci+	if (opts != ebt_original_options)
279a0061b6Sopenharmony_ci+		free(opts);
289a0061b6Sopenharmony_ci 
299a0061b6Sopenharmony_ci 	nft_fini(h);
309a0061b6Sopenharmony_ci 	xtables_fini();
319a0061b6Sopenharmony_ci-- 
329a0061b6Sopenharmony_ci2.23.0
33