UPSTREAM: netfilter: xt_TCPMSS: fix handling of malformed TCP header and options

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.

BUG=chromium:803812
TEST=Build and run

Change-Id: I956100476415c1c01908768c60c30c82d7fdf78c
Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit 71ffe9c77dd7a2b62207953091efa8dafec958dd)
(cherry picked from commit 0f465f72253fe2e10fb80deeea93f1e5698c62d7)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/875887
1 file changed