forked from Minki/linux
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>
This commit is contained in:
parent
d78c68efa8
commit
5e50732803
@ -1256,6 +1256,9 @@ static int bcm_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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user