Merge 242488, better use of strlcpy.
Submitted by: Eric van Gyzen <eric@vangyzen.net>
This commit is contained in:
parent
4a790edd1b
commit
5a3a8ec037
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242489
@ -720,6 +720,7 @@ SYSCTL_STRING(_kern_shutdown, OID_AUTO, dumpdevname, CTLFLAG_RD,
|
||||
int
|
||||
set_dumper(struct dumperinfo *di, const char *devname)
|
||||
{
|
||||
size_t wantcopy;
|
||||
|
||||
if (di == NULL) {
|
||||
bzero(&dumper, sizeof dumper);
|
||||
@ -729,8 +730,8 @@ set_dumper(struct dumperinfo *di, const char *devname)
|
||||
if (dumper.dumper != NULL)
|
||||
return (EBUSY);
|
||||
dumper = *di;
|
||||
strlcpy(dumpdevname, devname, sizeof(dumpdevname));
|
||||
if (strlen(dumpdevname) != strlen(devname)) {
|
||||
wantcopy = strlcpy(dumpdevname, devname, sizeof(dumpdevname));
|
||||
if (wantcopy >= sizeof(dumpdevname)) {
|
||||
printf("set_dumper: device name truncated from '%s' -> '%s'\n",
|
||||
devname, dumpdevname);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user