Explicitly terminate the string after strncpy(3).
This commit is contained in:
parent
68f6dc6efd
commit
e96225dccb
@ -422,6 +422,7 @@ zfs_probe_partition(void *arg, const char *partname,
|
|||||||
|
|
||||||
ppa = (struct zfs_probe_args *)arg;
|
ppa = (struct zfs_probe_args *)arg;
|
||||||
strncpy(devname, ppa->devname, strlen(ppa->devname) - 1);
|
strncpy(devname, ppa->devname, strlen(ppa->devname) - 1);
|
||||||
|
devname[strlen(ppa->devname) - 1] = '\0';
|
||||||
sprintf(devname, "%s%s:", devname, partname);
|
sprintf(devname, "%s%s:", devname, partname);
|
||||||
pa.fd = open(devname, O_RDONLY);
|
pa.fd = open(devname, O_RDONLY);
|
||||||
if (pa.fd == -1)
|
if (pa.fd == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user