netfilter: xt_TCPMSS: fix handling of malformed TCP header and options
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 25 Jul 2013 08:37:49 +0000 (10:37 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Feb 2018 18:32:21 +0000 (18:32 +0000)
commite1737daf2445ad3c1fd7435104a2aa8c96667349
tree00dbccf6f5e22bde13baebab1781fc5b07282292
parentc8b37154268611691b395e4dd19a3bf1a87d57ef
netfilter: xt_TCPMSS: fix handling of malformed TCP header and options

commit 71ffe9c77dd7a2b62207953091efa8dafec958dd upstream.

Make sure the packet has enough room for the TCP header and
that it is not malformed.

While at it, store tcph->doff*4 in a variable, as it is used
several times.

This patch also fixes a possible off by one in case of malformed
TCP options.

Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/netfilter/xt_TCPMSS.c