Skip to contentSkip to conversation

netfilter: ebtables: module names must be null-terminated

PATCH New Florian Westphal 1 participant 1 message Jul 6

Subsystems (3)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: ebtables: module names must be null-terminated

We need to explicitly check the length, else we may pass non-null terminated string to request_module().

Fixes bcf493428840 ("netfilter: ebtables: Fix extension lookup with identical name")
---
 net/bridge/netfilter/ebtables.c | 3 +++
 1 file changed, 3 insertions(+)
net/bridge/netfilter/ebtables.c +3 -0
index 48187598cdd0..96c9a8f57c87 100644
@@ -403,6 +403,9 @@ ebt_check_match(struct ebt_entry_match *m, struct xt_mtchk_param *par,
 	    left - sizeof(struct ebt_entry_match) < m->match_size)
 		return -EINVAL;
 
+	if (strnlen(m->u.name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
+		return -EINVAL;
+
 	match = xt_find_match(NFPROTO_BRIDGE, m->u.name, m->u.revision);
 	if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) {
 		if (!IS_ERR(match))
Signature · 1 line
2.54.0