From 198ddcca4bc4cafbf5d2f4145520de4e52c3f43d Mon Sep 17 00:00:00 2001 From: njoly Date: Thu, 11 Jun 2009 19:57:58 +0000 Subject: In sendmsg(2), do copy the msghdr structure before trying to use it. --- sys/compat/linux/common/linux_socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/compat/linux/common/linux_socket.c') diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c index e8b3b9696a9..05efed91c47 100644 --- a/sys/compat/linux/common/linux_socket.c +++ b/sys/compat/linux/common/linux_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.c,v 1.99 2008/11/19 18:36:03 ad Exp $ */ +/* $NetBSD: linux_socket.c,v 1.100 2009/06/11 19:57:58 njoly Exp $ */ /*- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.99 2008/11/19 18:36:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.100 2009/06/11 19:57:58 njoly Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -409,6 +409,10 @@ linux_sys_sendmsg(struct lwp *l, const struct linux_sys_sendmsg_args *uap, regis u_int8_t *control; struct mbuf *ctl_mbuf = NULL; + error = copyin(SCARG(uap, msg), &msg, sizeof(msg)); + if (error) + return error; + msg.msg_flags = MSG_IOVUSRSPACE; /* -- cgit