Skip to content

Commit

Permalink
x25: Prevent skb overreads when checking call user data
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Andrew Hendry <[email protected]>
Cc: stable <[email protected]>
Acked-by: Andrew Hendry <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Matthew Daley authored and davem330 committed Oct 17, 2011
1 parent cb101ed commit 7f81e25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/x25/af_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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) {
Expand Down

0 comments on commit 7f81e25

Please sign in to comment.