aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/sco.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r--net/bluetooth/sco.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index ac4631d10e0..21aded9a394 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -476,6 +476,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
+ if (alen < sizeof(struct sockaddr_sco))
+ return -EINVAL;
+
memset(&sa, 0, sizeof(sa));
len = min_t(unsigned int, sizeof(sa), alen);
memcpy(&sa, addr, len);