Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern The userland namelen is size_t, but the kernel hold...
details: https://anonhg.NetBSD.org/src/rev/389cfebefba3
branches: trunk
changeset: 333130:389cfebefba3
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Oct 20 08:20:08 2014 +0000
description:
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
diffstat:
sys/kern/kern_prot.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 3bc54cb959fa -r 389cfebefba3 sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c Mon Oct 20 07:13:27 2014 +0000
+++ b/sys/kern/kern_prot.c Mon Oct 20 08:20:08 2014 +0000
@@ -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 @@
} */
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);
Home |
Main Index |
Thread Index |
Old Index