Module Name:    src
Committed By:   msaitoh
Date:           Fri Aug  8 06:56:50 UTC 2014

Modified Files:
        src/sys/compat/linux/common [netbsd-5-1]: linux_socketcall.c
        src/sys/compat/linux32/common [netbsd-5-1]: linux32_socketcall.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1916):
        sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
        sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.20.1 \
    src/sys/compat/linux/common/linux_socketcall.c
cvs rdiff -u -r1.6 -r1.6.26.1 \
    src/sys/compat/linux32/common/linux32_socketcall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_socketcall.c
diff -u src/sys/compat/linux/common/linux_socketcall.c:1.39 src/sys/compat/linux/common/linux_socketcall.c:1.39.20.1
--- src/sys/compat/linux/common/linux_socketcall.c:1.39	Thu Jul  3 14:07:09 2008
+++ src/sys/compat/linux/common/linux_socketcall.c	Fri Aug  8 06:56:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socketcall.c,v 1.39 2008/07/03 14:07:09 njoly Exp $	*/
+/*	$NetBSD: linux_socketcall.c,v 1.39.20.1 2014/08/08 06:56:50 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.39 2008/07/03 14:07:09 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.39.20.1 2014/08/08 06:56:50 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -123,7 +123,7 @@ linux_sys_socketcall(struct lwp *l, cons
 	struct linux_socketcall_dummy_args lda;
 	int error;
 
-	if (SCARG(uap, what) < 0 || SCARG(uap, what) > LINUX_MAX_SOCKETCALL)
+	if (SCARG(uap, what) <= 0 || SCARG(uap, what) > LINUX_MAX_SOCKETCALL)
 		return ENOSYS;
 
 	if ((error = copyin(SCARG(uap, args), &lda,

Index: src/sys/compat/linux32/common/linux32_socketcall.c
diff -u src/sys/compat/linux32/common/linux32_socketcall.c:1.6 src/sys/compat/linux32/common/linux32_socketcall.c:1.6.26.1
--- src/sys/compat/linux32/common/linux32_socketcall.c:1.6	Thu Dec 20 23:02:58 2007
+++ src/sys/compat/linux32/common/linux32_socketcall.c	Fri Aug  8 06:56:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socketcall.c,v 1.6 2007/12/20 23:02:58 dsl Exp $ */
+/*	$NetBSD: linux32_socketcall.c,v 1.6.26.1 2014/08/08 06:56:50 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,7 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_socketcall.c,v 1.6 2007/12/20 23:02:58 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socketcall.c,v 1.6.26.1 2014/08/08 06:56:50 msaitoh Exp $");
 
 #include "opt_ktrace.h"
 #include <sys/types.h>
@@ -95,7 +95,7 @@ linux32_sys_socketcall(struct lwp *l, co
 	union linux32_socketcall_args ua;
 	int error;
 
-	if (SCARG(uap, what) < 0 || SCARG(uap, what) > LINUX32_MAX_SOCKETCALL)
+	if (SCARG(uap, what) <= 0 || SCARG(uap, what) > LINUX32_MAX_SOCKETCALL)
 		return ENOSYS;
 
 	if ((error = copyin(SCARG_P32(uap, args), &ua,

Reply via email to