Skip to contentSkip to conversation

fix is_same with userspacesize != size in targets

PATCH New Pablo Neira 1 participant 1 message Mar 6, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix is_same with userspacesize != size in targets

I've discovered a bug in same_is while fixing deletion in CLUSTERIP.

CLUSTERIP has to define a different userspacesize for the private target info because of the config pointer, this should be enough to fix rule deletion but the function same_is returns a wrong pointer to the comparation mask array since it doesn't add the size of ipt_entry. Because of that, target_same returns 0 and no rule matches.

Impact: This just affects rule deletion with targets that has userspacesize != size.

--
Pablo

libip4tc.c +1 -0
Index: libiptc/libip4tc.c
===================================================================
@@ -210,6 +210,7 @@
 	mptr = matchmask + sizeof(STRUCT_ENTRY);
 	if (IPT_MATCH_ITERATE(a, match_different, a->elems, b->elems, &mptr))
 		return NULL;
+	mptr += IPT_ALIGN(sizeof(struct ipt_entry_target));
 
 	return mptr;
 }
libip6tc.c +1 -0
Index: libiptc/libip6tc.c
===================================================================
@@ -242,6 +242,7 @@
 	mptr = matchmask + sizeof(STRUCT_ENTRY);
 	if (IP6T_MATCH_ITERATE(a, match_different, a->elems, b->elems, &mptr))
 		return NULL;
+	mptr += IP6T_ALIGN(sizeof(struct ip6t_entry_target));
 
 	return mptr;
 }