summaryrefslogtreecommitdiff
path: root/sys/compat/osf1/osf1_misc.c
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-06-22 23:52:19 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-06-22 23:52:19 +0000
commit68fe655b77ab978f8d03f8feec46801220bd46c5 (patch)
treecf71e1513645d4dd977c3b1b4a92d6ec1578c8f6 /sys/compat/osf1/osf1_misc.c
parent5557b30319fbfe74844a640472fa29a826d1be8b (diff)
Replace a whole bunch of scary uses of strncpy() with strlcpy() and
use compat-specific MAXNAMLEN values where appropriate ok millert@, pedro@
Diffstat (limited to 'sys/compat/osf1/osf1_misc.c')
-rw-r--r--sys/compat/osf1/osf1_misc.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/compat/osf1/osf1_misc.c b/sys/compat/osf1/osf1_misc.c
index de227667a5c..3c94c5b17d7 100644
--- a/sys/compat/osf1/osf1_misc.c
+++ b/sys/compat/osf1/osf1_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osf1_misc.c,v 1.14 2002/03/14 20:31:31 mickey Exp $ */
+/* $OpenBSD: osf1_misc.c,v 1.15 2004/06/22 23:52:18 jfb Exp $ */
/* $NetBSD: osf1_misc.c,v 1.55 2000/06/28 15:39:33 mrg Exp $ */
/*
@@ -246,15 +246,9 @@ osf1_sys_uname(p, v, retval)
/* XXX would use stackgap, but our struct utsname is too big! */
bzero(&u, sizeof(u));
-
- strncpy(u.sysname, ostype, sizeof(u.sysname));
- u.sysname[sizeof(u.sysname) - 1] = '\0';
-
- strncpy(u.nodename, hostname, sizeof(u.nodename));
- u.nodename[sizeof(u.nodename) - 1] = '\0';
-
- strncpy(u.release, osrelease, sizeof(u.release));
- u.release[sizeof(u.release) - 1] = '\0';
+ strlcpy(u.sysname, ostype, sizeof(u.sysname));
+ strlcpy(u.nodename, hostname, sizeof(u.nodename));
+ strlcpy(u.release, osrelease, sizeof(u.release));
dp = u.version;
ep = &u.version[sizeof(u.version) - 1];
@@ -268,8 +262,7 @@ osf1_sys_uname(p, v, retval)
*dp++ = *cp;
*dp = '\0';
- strncpy(u.machine, machine, sizeof(u.machine));
- u.machine[sizeof(u.machine) - 1] = '\0';
+ strlcpy(u.machine, machine, sizeof(u.machine));
return (copyout((caddr_t)&u, (caddr_t)SCARG(uap, name), sizeof u));
}