From 64673a6c31ccede36d85a490c1adcaab48b1cfc2 Mon Sep 17 00:00:00 2001 From: maxv Date: Sat, 21 Jun 2014 10:23:07 +0000 Subject: 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@ --- sys/compat/linux/common/linux_socketcall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/compat/linux/common/linux_socketcall.c') diff --git a/sys/compat/linux/common/linux_socketcall.c b/sys/compat/linux/common/linux_socketcall.c index 96e20262bc4..a4ac9c38103 100644 --- a/sys/compat/linux/common/linux_socketcall.c +++ b/sys/compat/linux/common/linux_socketcall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socketcall.c,v 1.43 2013/12/27 15:10:53 njoly Exp $ */ +/* $NetBSD: linux_socketcall.c,v 1.44 2014/06/21 10:23:07 maxv Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.43 2013/12/27 15:10:53 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.44 2014/06/21 10:23:07 maxv Exp $"); #include #include @@ -125,7 +125,7 @@ linux_sys_socketcall(struct lwp *l, const struct linux_sys_socketcall_args *uap, 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, -- cgit