diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c index 7bb25e004706..8dc65a8112ae 100644 --- a/sys/compat/svr4/svr4_sockio.c +++ b/sys/compat/svr4/svr4_sockio.c @@ -122,7 +122,7 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd, data) if ((error = copyin(data, &sr, sizeof(sr))) != 0) return error; - (void) strncpy(br.ifr_name, sr.svr4_ifr_name, + (void) strlcpy(br.ifr_name, sr.svr4_ifr_name, sizeof(br.ifr_name)); if ((error = fo_ioctl(fp, SIOCGIFFLAGS, (caddr_t) &br, td->td_ucred, diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c index b1d63ecbad09..351c6c77a0ee 100644 --- a/sys/compat/svr4/svr4_stat.c +++ b/sys/compat/svr4/svr4_stat.c @@ -477,19 +477,11 @@ svr4_sys_uname(td, uap) memset(&sut, 0, sizeof(sut)); - strncpy(sut.sysname, ostype, sizeof(sut.sysname)); - sut.sysname[sizeof(sut.sysname) - 1] = '\0'; - + strlcpy(sut.sysname, ostype, sizeof(sut.sysname)); getcredhostname(td->td_ucred, sut.nodename, sizeof(sut.nodename)); - - strncpy(sut.release, osrelease, sizeof(sut.release)); - sut.release[sizeof(sut.release) - 1] = '\0'; - - strncpy(sut.version, version, sizeof(sut.version)); - sut.version[sizeof(sut.version) - 1] = '\0'; - - strncpy(sut.machine, machine, sizeof(sut.machine)); - sut.machine[sizeof(sut.machine) - 1] = '\0'; + strlcpy(sut.release, osrelease, sizeof(sut.release)); + strlcpy(sut.version, version, sizeof(sut.version)); + strlcpy(sut.machine, machine, sizeof(sut.machine)); return copyout((caddr_t) &sut, (caddr_t) SCARG(uap, name), sizeof(struct svr4_utsname));