mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 07:01:57 +00:00
netfilter: nf_tables: improve nft payload fast eval
There's an off-by-one issue in nft_payload_fast_eval, skb_tail_pointer and ptr + priv->len all point to the last valid address plus 1. So if they are equal, we can still fetch the valid data. It's unnecessary to fall back to nft_payload_eval. Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
2462f3f4a7
commit
8dc3c2b86b
@ -98,7 +98,7 @@ static bool nft_payload_fast_eval(const struct nft_expr *expr,
|
||||
|
||||
ptr += priv->offset;
|
||||
|
||||
if (unlikely(ptr + priv->len >= skb_tail_pointer(skb)))
|
||||
if (unlikely(ptr + priv->len > skb_tail_pointer(skb)))
|
||||
return false;
|
||||
|
||||
*dest = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user