From e96225dccbcdd2775ef28b26baf1d1f833b2dd97 Mon Sep 17 00:00:00 2001 From: ae Date: Wed, 15 Aug 2012 09:18:49 +0000 Subject: [PATCH] Explicitly terminate the string after strncpy(3). --- sys/boot/zfs/zfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/boot/zfs/zfs.c b/sys/boot/zfs/zfs.c index d7ea878ca520..baad8db82925 100644 --- a/sys/boot/zfs/zfs.c +++ b/sys/boot/zfs/zfs.c @@ -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)