diff options
author | Matthew Daley <mattjd@gmail.com> | 2011-10-14 18:45:05 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-07 12:32:15 -0800 |
commit | 72760fea8e88dac78985e6f493c1f86b90c1fc0d (patch) | |
tree | 51b523862e2935c995367ab91e4b3cf43c53c47c /net | |
parent | ec13cb15c2164ac096d71ebbe2c9869eee482d27 (diff) |
x25: Prevent skb overreads when checking call user data
commit 7f81e25befdfb3272345a2e775f520e1d515fa20 upstream.
x25_find_listener does not check that the amount of call user data given
in the skb is big enough in per-socket comparisons, hence buffer
overreads may occur. Fix this by adding a check.
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Acked-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/x25/af_x25.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index d00681646d1..2e9e30025d6 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -294,7 +294,8 @@ static struct sock *x25_find_listener(struct x25_address *addr, * Found a listening socket, now check the incoming * call user data vs this sockets call user data */ - if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) { + if (x25_sk(s)->cudmatchlength > 0 && + skb->len >= x25_sk(s)->cudmatchlength) { if((memcmp(x25_sk(s)->calluserdata.cuddata, skb->data, x25_sk(s)->cudmatchlength)) == 0) { |