summaryrefslogtreecommitdiffstats
path: root/cmd/zfs
diff options
context:
space:
mode:
authorluozhengzheng <[email protected]>2016-09-23 06:55:41 +0800
committerBrian Behlendorf <[email protected]>2016-09-22 15:55:41 -0700
commit5df39c1e43e8d903ef4317e505cf85e64ef7e172 (patch)
tree8470347847a8194d79edffe92ab6b310cc97dbdf /cmd/zfs
parent3ec68a4414ececbae227a508bcc7e236c358e64c (diff)
Fix coverity defects
1.coverity scan CID:147445 function zfs_do_send in zfs_main.c Buffer not null terminated (BUFFER_SIZE_WARNING) 2.coverity scan CID:147443 function zfs_do_bookmark in zfs_main.c Buffer not null terminated (BUFFER_SIZE_WARNING) 3.coverity scan CID:147660 function main in zinject.c Passing string argv[0] of unknown size to strcpy By the way, the leak of g_zfs is fixed. 4.coverity scan CID: 147442 function make_disks in zpool_vdev.c Buffer not null terminated (BUFFER_SIZE_WARNING) 5.coverity scan CID: 147661 function main in dir_rd_update.c passing string cp1 of unknown size to strcpy Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: luozhengzheng <[email protected]> Closes #5130
Diffstat (limited to 'cmd/zfs')
-rw-r--r--cmd/zfs/zfs_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index cca52dbe7..301e2957e 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -3865,7 +3865,7 @@ zfs_do_send(int argc, char **argv)
* Incremental source name begins with # or @.
* Default to same fs as target.
*/
- (void) strncpy(frombuf, argv[0], sizeof (frombuf));
+ (void) strlcpy(frombuf, argv[0], sizeof (frombuf));
cp = strchr(frombuf, '@');
if (cp != NULL)
*cp = '\0';
@@ -6771,7 +6771,7 @@ zfs_do_bookmark(int argc, char **argv)
*strchr(snapname, '#') = '\0';
(void) strlcat(snapname, argv[0], sizeof (snapname));
} else {
- (void) strncpy(snapname, argv[0], sizeof (snapname));
+ (void) strlcpy(snapname, argv[0], sizeof (snapname));
}
zhp = zfs_open(g_zfs, snapname, ZFS_TYPE_SNAPSHOT);
if (zhp == NULL)