diff options
-rw-r--r-- | net/compat.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/compat.c b/net/compat.c index a5848acc1738..8e39ff816fbf 100644 --- a/net/compat.c +++ b/net/compat.c @@ -69,6 +69,13 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || __get_user(kmsg->msg_flags, &umsg->msg_flags)) return -EFAULT; + + if (!tmp1) + kmsg->msg_namelen = 0; + + if (kmsg->msg_namelen < 0) + return -EINVAL; + if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) kmsg->msg_namelen = sizeof(struct sockaddr_storage); kmsg->msg_name = compat_ptr(tmp1); |