Replace the conventional usage of strncpy() by using strlcpy().
This commit is contained in:
parent
75e8f2dad8
commit
f9067a4978
@ -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,
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user