Skip to content

Commit

Permalink
netfilter: nf_ct_tcp: fix incorrect handling of invalid TCP option
Browse files Browse the repository at this point in the history
Michael M. Builov reported that in the tcp_options and tcp_sack functions
of netfilter TCP conntrack the incorrect handling of invalid TCP option
with too big opsize may lead to read access beyond tcp-packet or buffer
allocated on stack (netfilter bugzilla #738). The fix is to stop parsing
the options at detecting the broken option.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Jozsef Kadlecsik authored and Patrick McHardy committed Aug 30, 2011
1 parent 4c6e420 commit 4a5cc84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nf_conntrack_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static void tcp_options(const struct sk_buff *skb,
if (opsize < 2) /* "silly options" */
return;
if (opsize > length)
break; /* don't parse partial options */
return; /* don't parse partial options */

if (opcode == TCPOPT_SACK_PERM
&& opsize == TCPOLEN_SACK_PERM)
Expand Down Expand Up @@ -469,7 +469,7 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
if (opsize < 2) /* "silly options" */
return;
if (opsize > length)
break; /* don't parse partial options */
return; /* don't parse partial options */

if (opcode == TCPOPT_SACK
&& opsize >= (TCPOLEN_SACK_BASE
Expand Down

0 comments on commit 4a5cc84

Please sign in to comment.