Module Name:    src
Committed By:   martin
Date:           Tue Apr 26 19:58:13 UTC 2011

Modified Files:
        src/sys/kern: kern_prot.c

Log Message:
Stupidly (but standards commpliant) the gidsetsize argument of the
getgroups() syscall is "int" - i.e. signed.
Explicitly check for negative values and make them fail.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/kern/kern_prot.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/kern/kern_prot.c
diff -u src/sys/kern/kern_prot.c:1.111 src/sys/kern/kern_prot.c:1.112
--- src/sys/kern/kern_prot.c:1.111	Mon Aug 30 10:30:01 2010
+++ src/sys/kern/kern_prot.c	Tue Apr 26 19:58:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_prot.c,v 1.111 2010/08/30 10:30:01 pooka Exp $	*/
+/*	$NetBSD: kern_prot.c,v 1.112 2011/04/26 19:58:12 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.111 2010/08/30 10:30:01 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.112 2011/04/26 19:58:12 martin Exp $");
 
 #include "opt_compat_43.h"
 
@@ -231,6 +231,8 @@
 	*retval = kauth_cred_ngroups(l->l_cred);
 	if (SCARG(uap, gidsetsize) == 0)
 		return 0;
+	if (SCARG(uap, gidsetsize) < 0)
+		return EINVAL;
 	if (SCARG(uap, gidsetsize) < *retval)
 		return EINVAL;
 

Reply via email to