]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/can/bcm.c
net: check the length of the socket address passed to connect(2)
[net-next-2.6.git] / net / can / bcm.c
index e32af52238a2a437787b4adaa7a7616e195b0e57..629ad1debe81db814f2105804ecd9a45b90bbbcd 100644 (file)
@@ -1478,6 +1478,9 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
        struct sock *sk = sock->sk;
        struct bcm_sock *bo = bcm_sk(sk);
 
+       if (len < sizeof(*addr))
+               return -EINVAL;
+
        if (bo->bound)
                return -EISCONN;