diff options
author | cao <[email protected]> | 2016-09-26 06:08:28 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-09-25 15:08:28 -0700 |
commit | 680eada9b05415a8e564eb345f062f357d66f0f1 (patch) | |
tree | c5f5e5d881d09166544b6a18bdf00f8dea5d48fa /module/zfs/zfs_ioctl.c | |
parent | 92bc9278689fcce48183182f2488ead42a9eb790 (diff) |
Fix coverity defects: CID 147650, 147649, 147647, 147646
coverity scan CID:147650, Type:copy into fixed size buffer.
coverity scan CID:147649, Type:copy into fixed size buffer.
coverity scan CID:147647, Type:copy into fixed size buffer.
coverity scan CID:147646, Type:copy into fixed size buffer.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: cao.xuewen <[email protected]>
Closes #5161
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r-- | module/zfs/zfs_ioctl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 0385bfcbb..64f630108 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3928,12 +3928,13 @@ zfs_check_clearable(char *dataset, nvlist_t *props, nvlist_t **errlist) VERIFY(nvlist_alloc(&errors, NV_UNIQUE_NAME, KM_SLEEP) == 0); zc = kmem_alloc(sizeof (zfs_cmd_t), KM_SLEEP); - (void) strcpy(zc->zc_name, dataset); + (void) strlcpy(zc->zc_name, dataset, sizeof (zc->zc_name)); pair = nvlist_next_nvpair(props, NULL); while (pair != NULL) { next_pair = nvlist_next_nvpair(props, pair); - (void) strcpy(zc->zc_value, nvpair_name(pair)); + (void) strlcpy(zc->zc_value, nvpair_name(pair), + sizeof (zc->zc_value)); if ((err = zfs_check_settable(dataset, pair, CRED())) != 0 || (err = zfs_secpolicy_inherit_prop(zc, NULL, CRED())) != 0) { VERIFY(nvlist_remove_nvpair(props, pair) == 0); @@ -4951,7 +4952,8 @@ zfs_ioc_tmp_snapshot(zfs_cmd_t *zc) error = dsl_dataset_snapshot_tmp(zc->zc_name, snap_name, minor, hold_name); if (error == 0) - (void) strcpy(zc->zc_value, snap_name); + (void) strlcpy(zc->zc_value, snap_name, + sizeof (zc->zc_value)); strfree(snap_name); strfree(hold_name); zfs_onexit_fd_rele(zc->zc_cleanup_fd); |