Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit cfd39c3

Browse files
Matthew DaleyTapani-
authored andcommitted
x25: Prevent skb overreads when checking call user data
commit 7f81e25 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 <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Andrew Hendry <[email protected]> Acked-by: Andrew Hendry <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 45d9ace commit cfd39c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/x25/af_x25.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ static struct sock *x25_find_listener(struct x25_address *addr,
295295
* Found a listening socket, now check the incoming
296296
* call user data vs this sockets call user data
297297
*/
298-
if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) {
298+
if (x25_sk(s)->cudmatchlength > 0 &&
299+
skb->len >= x25_sk(s)->cudmatchlength) {
299300
if((memcmp(x25_sk(s)->calluserdata.cuddata,
300301
skb->data,
301302
x25_sk(s)->cudmatchlength)) == 0) {

0 commit comments

Comments
 (0)