summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2002-10-17 22:00:30 +0000
committerrobert <robert@FreeBSD.org>2002-10-17 22:00:30 +0000
commitec6b5086a5eddbe9100861c1ae05528755a9c0ad (patch)
treef5dda382a5a4426b653da477d518f802cfac4977 /sys/compat
parentc9d1c245f8dcfe88be2d4c0056b9f9015905c848 (diff)
downloadFreeBSD-src-ec6b5086a5eddbe9100861c1ae05528755a9c0ad.zip
FreeBSD-src-ec6b5086a5eddbe9100861c1ae05528755a9c0ad.tar.gz
- Use strlcpy() rather than strncpy() to copy NUL terminated
strings. - Pass the correct buffer size to getcredhostname().
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_misc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 16c8677..6b2dda9 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -704,12 +704,12 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args)
linux_get_osrelease(td->td_proc, osrelease);
bzero(&utsname, sizeof(utsname));
- strncpy(utsname.sysname, osname, LINUX_MAX_UTSNAME-1);
- getcredhostname(td->td_ucred, utsname.nodename, LINUX_MAX_UTSNAME-1);
- strncpy(utsname.release, osrelease, LINUX_MAX_UTSNAME-1);
- strncpy(utsname.version, version, LINUX_MAX_UTSNAME-1);
- strncpy(utsname.machine, machine, LINUX_MAX_UTSNAME-1);
- strncpy(utsname.domainname, domainname, LINUX_MAX_UTSNAME-1);
+ strlcpy(utsname.sysname, osname, LINUX_MAX_UTSNAME);
+ getcredhostname(td->td_ucred, utsname.nodename, LINUX_MAX_UTSNAME);
+ strlcpy(utsname.release, osrelease, LINUX_MAX_UTSNAME);
+ strlcpy(utsname.version, version, LINUX_MAX_UTSNAME);
+ strlcpy(utsname.machine, machine, LINUX_MAX_UTSNAME);
+ strlcpy(utsname.domainname, domainname, LINUX_MAX_UTSNAME);
return (copyout(&utsname, (caddr_t)args->buf, sizeof(utsname)));
}
OpenPOWER on IntegriCloud