Module Name: src
Committed By: maxv
Date: Mon Oct 20 08:20:08 UTC 2014
Modified Files:
src/sys/kern: kern_prot.c
Log Message:
The userland namelen is size_t, but the kernel holds it in an int. The
sizeof(login) test implicitly interprets 'namelen' as unsigned, which
means that negative values get kicked anyway. Still this is fragile, so:
int -> size_t
To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 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.117 src/sys/kern/kern_prot.c:1.118
--- src/sys/kern/kern_prot.c:1.117 Mon Nov 25 16:28:20 2013
+++ src/sys/kern/kern_prot.c Mon Oct 20 08:20:08 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_prot.c,v 1.117 2013/11/25 16:28:20 rmind Exp $ */
+/* $NetBSD: kern_prot.c,v 1.118 2014/10/20 08:20:08 maxv 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.117 2013/11/25 16:28:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.118 2014/10/20 08:20:08 maxv Exp $");
#include "opt_compat_43.h"
@@ -590,7 +590,7 @@ sys___getlogin(struct lwp *l, const stru
} */
struct proc *p = l->l_proc;
char login[sizeof(p->p_session->s_login)];
- int namelen = SCARG(uap, namelen);
+ size_t namelen = SCARG(uap, namelen);
if (namelen > sizeof(login))
namelen = sizeof(login);