mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
netfilter: xt_tcpmss: check remaining length before reading optlen
Quoting reporter: In net/netfilter/xt_tcpmss.c (lines 53-68), the TCP option parser reads op[i+1] directly without validating the remaining option length. If the last byte of the option field is not EOL/NOP (0/1), the code attempts to index op[i+1]. In the case where i + 1 == optlen, this causes an out-of-bounds read, accessing memory past the optlen boundary (either reading beyond the stack buffer _opt or the following payload). Reported-by: sungzii <sungzii@pm.me> Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
parent
de8a70cefc
commit
735ee8582d
1 changed files with 1 additions and 1 deletions
|
|
@ -61,7 +61,7 @@ tcpmss_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
|||
return (mssval >= info->mss_min &&
|
||||
mssval <= info->mss_max) ^ info->invert;
|
||||
}
|
||||
if (op[i] < 2)
|
||||
if (op[i] < 2 || i == optlen - 1)
|
||||
i++;
|
||||
else
|
||||
i += op[i+1] ? : 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue