summaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorGeLiXin <[email protected]>2016-10-14 05:02:07 +0800
committerBrian Behlendorf <[email protected]>2016-10-13 14:02:07 -0700
commit45cb520b9d1b8200992f879d1ed6f472e94c6c6b (patch)
treecb7694c3208d3a074360f1c0d1a4178b2a3e98a9 /lib/libzfs
parent1f51b525ff67e2c5cc26d968287bd9a7579acebd (diff)
Fix coverity defects: CID 147654, 147690
coverity scan CID:147654,type: Copy into fixed size buffer - string operation may write past the end of the fixed-size destination buffer coverity scan CID:147690,type: Uninitialized scalar variable - call zfs_prop_get first in case we use sourcetype and share_sourcetype without initialization Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: GeLiXin <[email protected]> Closes #5253
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_changelist.c4
-rw-r--r--lib/libzfs/libzfs_sendrecv.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c
index ed11bb822..397f27872 100644
--- a/lib/libzfs/libzfs_changelist.c
+++ b/lib/libzfs/libzfs_changelist.c
@@ -397,8 +397,8 @@ change_one(zfs_handle_t *zhp, void *data)
char property[ZFS_MAXPROPLEN];
char where[64];
prop_changenode_t *cn;
- zprop_source_t sourcetype;
- zprop_source_t share_sourcetype;
+ zprop_source_t sourcetype = ZPROP_SRC_NONE;
+ zprop_source_t share_sourcetype = ZPROP_SRC_NONE;
/*
* We only want to unmount/unshare those filesystems that may inherit
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index 55131369e..21d67e74d 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -3213,7 +3213,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
/*
* Determine name of destination snapshot.
*/
- (void) strcpy(destsnap, tosnap);
+ (void) strlcpy(destsnap, tosnap, sizeof (destsnap));
(void) strlcat(destsnap, chopprefix, sizeof (destsnap));
free(cp);
if (!zfs_name_valid(destsnap, ZFS_TYPE_SNAPSHOT)) {