]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: ebtables: module names must be null-terminated
authorFlorian Westphal <fw@strlen.de>
Sat, 4 Jul 2026 10:05:15 +0000 (12:05 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 8 Jul 2026 13:22:03 +0000 (15:22 +0200)
We need to explicitly check the length, else we may pass non-null
terminated string to request_module().

Cc: stable@vger.kernel.org
Fixes: bcf493428840 ("netfilter: ebtables: Fix extension lookup with identical name")
Signed-off-by: Florian Westphal <fw@strlen.de>
net/bridge/netfilter/ebtables.c

index 48187598cdd03a2c33b794337869e1f6df003d54..96c9a8f57c87029cfdcec7cdc7cf219232533b7e 100644 (file)
@@ -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))