mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5161
This commit is contained in:
parent
92bc927868
commit
680eada9b0
@ -203,7 +203,8 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
|||||||
sizeof (foundobj), 1, &foundobj);
|
sizeof (foundobj), 1, &foundobj);
|
||||||
ASSERT(err || foundobj == ddobj);
|
ASSERT(err || foundobj == ddobj);
|
||||||
#endif
|
#endif
|
||||||
(void) strcpy(dd->dd_myname, tail);
|
(void) strlcpy(dd->dd_myname, tail,
|
||||||
|
sizeof (dd->dd_myname));
|
||||||
} else {
|
} else {
|
||||||
err = zap_value_search(dp->dp_meta_objset,
|
err = zap_value_search(dp->dp_meta_objset,
|
||||||
dsl_dir_phys(dd->dd_parent)->
|
dsl_dir_phys(dd->dd_parent)->
|
||||||
|
@ -1110,7 +1110,8 @@ again:
|
|||||||
if (mze->mze_name[0] == 0) {
|
if (mze->mze_name[0] == 0) {
|
||||||
mze->mze_value = value;
|
mze->mze_value = value;
|
||||||
mze->mze_cd = cd;
|
mze->mze_cd = cd;
|
||||||
(void) strcpy(mze->mze_name, zn->zn_key_orig);
|
(void) strlcpy(mze->mze_name, zn->zn_key_orig,
|
||||||
|
sizeof (mze->mze_name));
|
||||||
zap->zap_m.zap_num_entries++;
|
zap->zap_m.zap_num_entries++;
|
||||||
zap->zap_m.zap_alloc_next = i+1;
|
zap->zap_m.zap_alloc_next = i+1;
|
||||||
if (zap->zap_m.zap_alloc_next ==
|
if (zap->zap_m.zap_alloc_next ==
|
||||||
|
@ -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);
|
VERIFY(nvlist_alloc(&errors, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
||||||
|
|
||||||
zc = kmem_alloc(sizeof (zfs_cmd_t), KM_SLEEP);
|
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);
|
pair = nvlist_next_nvpair(props, NULL);
|
||||||
while (pair != NULL) {
|
while (pair != NULL) {
|
||||||
next_pair = nvlist_next_nvpair(props, pair);
|
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 ||
|
if ((err = zfs_check_settable(dataset, pair, CRED())) != 0 ||
|
||||||
(err = zfs_secpolicy_inherit_prop(zc, NULL, CRED())) != 0) {
|
(err = zfs_secpolicy_inherit_prop(zc, NULL, CRED())) != 0) {
|
||||||
VERIFY(nvlist_remove_nvpair(props, pair) == 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,
|
error = dsl_dataset_snapshot_tmp(zc->zc_name, snap_name, minor,
|
||||||
hold_name);
|
hold_name);
|
||||||
if (error == 0)
|
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(snap_name);
|
||||||
strfree(hold_name);
|
strfree(hold_name);
|
||||||
zfs_onexit_fd_rele(zc->zc_cleanup_fd);
|
zfs_onexit_fd_rele(zc->zc_cleanup_fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user