]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Fix for comparing ifname matches against nft-generated ones
authorPhil Sutter <phil@nwl.cc>
Thu, 1 Dec 2022 12:09:48 +0000 (13:09 +0100)
committerPhil Sutter <phil@nwl.cc>
Fri, 2 Dec 2022 00:47:32 +0000 (01:47 +0100)
Since nft adds the interface name as fixed-size string of 16 bytes,
filling a mask based on the length value will not match the mask nft
set.

Fixes: 652b98e793711 ("xtables-compat: fix wildcard detection")
Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft-shared.c

index f1503b6ce0cbc16e9c1ff481007e97e2e2ac06cf..03e13fdcb716ea047004bace3cd41f8882fd7c5f 100644 (file)
@@ -279,7 +279,7 @@ static void parse_ifname(const char *name, unsigned int len, char *dst, unsigned
        memcpy(dst, name, len);
        if (name[len - 1] == '\0') {
                if (mask)
-                       memset(mask, 0xff, len);
+                       memset(mask, 0xff, strlen(name) + 1);
                return;
        }