netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 7 May 2013 01:22:18 +0000 (03:22 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Feb 2018 18:32:20 +0000 (18:32 +0000)
commit24a6ca9612ff55f0608196663f843ee4f52ce28b
tree0440213f7e240780dcda2df1c78129affffce114
parentaf0dc5dfb4c810b3e98515cfba09f23afabf579b
netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary

commit bc6bcb59dd7c184d229f9e86d08aa56059938a4c upstream.

This target assumes that tcph->doff is well-formed, that may be well
not the case. Add extra sanity checkings to avoid possible crash due
to read/write out of the real packet boundary. After this patch, the
default action on malformed TCP packets is to drop them. Moreover,
fragments are skipped.

Reported-by: Rafal Kupka <rkupka@telemetry.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/netfilter/xt_TCPOPTSTRIP.c