1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Explicitly terminate the string after strncpy(3).

This commit is contained in:
Andrey V. Elsukov 2012-08-15 09:18:49 +00:00
parent b208396ea3
commit a188e43ef3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239292

View File

@ -422,6 +422,7 @@ zfs_probe_partition(void *arg, const char *partname,
ppa = (struct zfs_probe_args *)arg;
strncpy(devname, ppa->devname, strlen(ppa->devname) - 1);
devname[strlen(ppa->devname) - 1] = '\0';
sprintf(devname, "%s%s:", devname, partname);
pa.fd = open(devname, O_RDONLY);
if (pa.fd == -1)