1 Apr 2012 16:22
[PATCH] netfilter: check the length of the data before dereferencing it
Changli Gao <xiaosuo <at> gmail.com>
2012-04-01 14:22:50 GMT
2012-04-01 14:22:50 GMT
We should check the length of the data before dereferencing it when parsing the TCP options. Signed-off-by: Changli Gao <xiaosuo <at> gmail.com> --- net/netfilter/nf_conntrack_proto_tcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 361eade..9e446c5 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c <at> <at> -404,6 +404,8 <at> <at> static void tcp_options(const struct sk_buff *skb, length--; continue; default: + if (length < 2) + return; opsize=*ptr++; if (opsize < 2) /* "silly options" */ return; <at> <at> -464,6 +466,8 <at> <at> static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, length--; continue; default: + if (length < 2) + return; opsize = *ptr++; if (opsize < 2) /* "silly options" */ return; --(Continue reading)
RSS Feed