Skip to contentSkip to conversation

tc: m_xt: Prevent a segfault in libipt

PATCH Applied Phil Sutter 2 participants 2 messages May 23, 2017 – May 31, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: m_xt: Prevent a segfault in libipt

From: Phil Sutter <[email protected]>

This happens with NAT targets, such as SNAT, DNAT and MASQUERADE. These are still not usable with this patch, but at least tc doesn't crash anymore when one tries to use them.

---
 tc/m_xt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tc/m_xt.c +4 -1
index e59df8e10afef..ad52d239caf61 100644
@@ -146,6 +146,9 @@ static int parse_ipt(struct action_util *a, int *argc_p,
 		     char ***argv_p, int tca_id, struct nlmsghdr *n)
 {
 	struct xtables_target *m = NULL;
+#if XTABLES_VERSION_CODE >= 6
+	struct ipt_entry fw = {};
+#endif
 	struct rtattr *tail;
 
 	int c;
@@ -206,7 +209,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
 		default:
 #if XTABLES_VERSION_CODE >= 6
 			if (m != NULL && m->x6_parse != NULL) {
-				xtables_option_tpcall(c, argv, 0, m, NULL);
+				xtables_option_tpcall(c, argv, 0, m, &fw);
 #else
 			if (m != NULL && m->parse != NULL) {
 				m->parse(c - m->option_offset, argv, 0,
Signature · 1 line
2.11.0