Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Stupidly (but standards commpliant) the gidsetsize ...



details:   https://anonhg.NetBSD.org/src/rev/58e7ae7b933d
branches:  trunk
changeset: 764540:58e7ae7b933d
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 26 19:58:12 2011 +0000

description:
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.

diffstat:

 sys/kern/kern_prot.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 7869ee5941af -r 58e7ae7b933d sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c      Tue Apr 26 18:50:53 2011 +0000
+++ b/sys/kern/kern_prot.c      Tue Apr 26 19:58:12 2011 +0000
@@ -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;
 



Home | Main Index | Thread Index | Old Index