Skip to content

Commit 932909d

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: ebtables: fix erroneous reject of last rule
The last rule in the blob has next_entry offset that is same as total size. This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel. Fixes: b718121 ("netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 0d3601d commit 932909d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎net/bridge/netfilter/ebtables.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,12 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base,
21192119
* offsets are relative to beginning of struct ebt_entry (i.e., 0).
21202120
*/
21212121
for (i = 0; i < 4 ; ++i) {
2122-
if (offsets[i] >= *total)
2122+
if (offsets[i] > *total)
21232123
return -EINVAL;
2124+
2125+
if (i < 3 && offsets[i] == *total)
2126+
return -EINVAL;
2127+
21242128
if (i == 0)
21252129
continue;
21262130
if (offsets[i-1] > offsets[i])

0 commit comments

Comments
 (0)