- Use strlcpy() rather than strncpy() to copy NUL terminated
strings. - Pass the correct buffer size to getcredhostname().
This commit is contained in:
parent
37e7c03d19
commit
75e8f2dad8
@ -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)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user