bluetooth: Validate socket address length in sco_sock_bind().
authorDavid S. Miller <davem@davemloft.net>
Tue, 15 Dec 2015 20:39:08 +0000 (15:39 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Dec 2015 20:39:08 +0000 (15:39 -0500)
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bluetooth/sco.c

index fe129663bd3f7faeb39f20d02a8425d525da071d..f52bcbf2e58cd8b8ded4c3d65c8dd9b87034b002 100644 (file)
@@ -526,6 +526,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr,
        if (!addr || addr->sa_family != AF_BLUETOOTH)
                return -EINVAL;
 
+       if (addr_len < sizeof(struct sockaddr_sco))
+               return -EINVAL;
+
        lock_sock(sk);
 
        if (sk->sk_state != BT_OPEN) {