summaryrefslogtreecommitdiff
path: root/net/can/raw.c
diff options
context:
space:
mode:
authorKurt Van Dijck <kurt.van.dijck@eia.be>2011-01-15 20:56:42 -0800
committerDavid S. Miller <davem@davemloft.net>2011-01-15 20:56:42 -0800
commit5e5073280379d38e86ade471daa7443b553fc839 (patch)
tree18b76f530ec22b57b36de68b985ad32444066dcc /net/can/raw.c
parentd78c68efa84ff312f3663dbf921b1e3485232205 (diff)
downloadlinux-rpi3-5e5073280379d38e86ade471daa7443b553fc839.tar.gz
linux-rpi3-5e5073280379d38e86ade471daa7443b553fc839.tar.bz2
linux-rpi3-5e5073280379d38e86ade471daa7443b553fc839.zip
can: test size of struct sockaddr in sendmsg
This patch makes the CAN socket code conform to the manpage of sendmsg. Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can/raw.c')
-rw-r--r--net/can/raw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index e88f610fdb7b..883e9d74fddf 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -649,6 +649,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
struct sockaddr_can *addr =
(struct sockaddr_can *)msg->msg_name;
+ if (msg->msg_namelen < sizeof(*addr))
+ return -EINVAL;
+
if (addr->can_family != AF_CAN)
return -EINVAL;