Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/ibcs2 avoid out-of-bound memory access. found by...



details:   https://anonhg.NetBSD.org/src/rev/29ced0c9ecb1
branches:  trunk
changeset: 552728:29ced0c9ecb1
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Oct 01 08:03:48 2003 +0000

description:
avoid out-of-bound memory access.  found by openbsd "bound" C attribute.

diffstat:

 sys/compat/ibcs2/ibcs2_stat.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 6e3fef96bc5e -r 29ced0c9ecb1 sys/compat/ibcs2/ibcs2_stat.c
--- a/sys/compat/ibcs2/ibcs2_stat.c     Wed Oct 01 06:24:19 2003 +0000
+++ b/sys/compat/ibcs2/ibcs2_stat.c     Wed Oct 01 08:03:48 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_stat.c,v 1.26 2003/06/29 22:29:22 fvdl Exp $     */
+/*     $NetBSD: ibcs2_stat.c,v 1.27 2003/10/01 08:03:48 itojun Exp $   */
 /*
  * Copyright (c) 1995, 1998 Scott Bartram
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.26 2003/06/29 22:29:22 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.27 2003/10/01 08:03:48 itojun Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -370,7 +370,7 @@
                memcpy(sut.nodename, hostname, sizeof(sut.nodename));
                sut.nodename[sizeof(sut.nodename)-1] = '\0';
                memcpy(sut.release, osrelease, sizeof(sut.release) - 1);
-               memcpy(sut.version, "1", sizeof(sut.version) - 1);
+               strlcpy(sut.version, "1", sizeof(sut.version));
                memcpy(sut.machine, machine, sizeof(sut.machine) - 1);
 
                return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, a1),



Home | Main Index | Thread Index | Old Index