netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: check the length of the data before dereferencing it
@ 2012-04-02  3:10 Changli Gao
  2012-04-02  3:19 ` Eric Dumazet
  2012-04-02  3:19 ` David Miller
  0 siblings, 2 replies; 16+ messages in thread
From: Changli Gao @ 2012-04-02  3:10 UTC (permalink / raw)
  To: David S. Miller
  Cc: Patrick McHardy, Pablo Neira Ayuso, Eric Dumazet, netfilter-devel,
	netdev, Changli Gao

We should check the length of the data before dereferencing it when parsing
the TCP options.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/ipv4/tcp_input.c |    2 ++
 1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e886e2f..5099f08 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3845,6 +3845,8 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
 			length--;
 			continue;
 		default:
+			if (length < 2)
+				return;
 			opsize = *ptr++;
 			if (opsize < 2) /* "silly options" */
 				return;

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-04-02  6:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02  3:10 [PATCH] net: check the length of the data before dereferencing it Changli Gao
2012-04-02  3:19 ` Eric Dumazet
2012-04-02  3:29   ` David Miller
2012-04-02  3:45     ` Changli Gao
2012-04-02  3:53       ` Eric Dumazet
2012-04-02  3:57         ` David Miller
2012-04-02  3:59           ` Eric Dumazet
2012-04-02  4:47         ` Changli Gao
2012-04-02  4:54           ` Eric Dumazet
2012-04-02  6:27             ` Changli Gao
2012-04-02  6:43               ` Eric Dumazet
2012-04-02  3:45     ` Eric Dumazet
2012-04-02  3:55       ` David Miller
2012-04-02  3:58         ` Eric Dumazet
2012-04-02  4:14           ` David Miller
2012-04-02  3:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).