Skip to content

Commit

Permalink
tipc: validate length of sockaddr in connect() for dgram/rdm
Browse files Browse the repository at this point in the history
Commit f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
hasn't validated user input length for the sockaddr structure which allows
a user to overwrite kernel memory with arbitrary input.

Fixes: f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
Signed-off-by: Sasha Levin <[email protected]>
Acked-by: Ying Xue <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
sashalevin authored and davem330 committed Mar 24, 2015
1 parent 0117ec1 commit 610600c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,8 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
if (dst->family == AF_UNSPEC) {
memset(&tsk->remote, 0, sizeof(struct sockaddr_tipc));
tsk->connected = 0;
} else if (destlen != sizeof(struct sockaddr_tipc)) {
res = -EINVAL;
} else {
memcpy(&tsk->remote, dest, destlen);
tsk->connected = 1;
Expand Down

0 comments on commit 610600c

Please sign in to comment.