]> granicus.if.org Git - zfs/commitdiff
Properly NULL terminate string in zfs_strcmp_pathname
authorRichard Yao <ryao@gentoo.org>
Wed, 23 Apr 2014 00:25:39 +0000 (20:25 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 23 Sep 2014 17:32:21 +0000 (10:32 -0700)
The utility cppcheck caught this.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2330

lib/libzfs/libzfs_util.c

index d029b61e7c90ebe3a2e8680f9e838ea302baa781..7f947c186e1bcb11b5a4ade92526844e14ee3c83 100644 (file)
@@ -962,7 +962,7 @@ zfs_strcmp_pathname(char *name, char *cmp, int wholedisk)
        if (name[0] != '/')
                return (zfs_strcmp_shortname(name, cmp_name, wholedisk));
 
-       strncpy(path_name, name, MAXPATHLEN);
+       (void) strlcpy(path_name, name, MAXPATHLEN);
        path_len = strlen(path_name);
        cmp_len = strlen(cmp_name);