summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBearBabyLiu <[email protected]>2016-09-30 04:33:09 +0800
committerBrian Behlendorf <[email protected]>2016-09-29 13:33:09 -0700
commit0b78aeae927833de580e140375a15ea5ea9d924a (patch)
tree1781702621f0857b1c0586f5f825642609c8f5f0 /cmd
parente8ac4557af67a46a2cb90bd7db4d426c0b358d51 (diff)
Fix coverity defects: CID 147443, 147656, 147655, 147441, 147653
coverity scan CID:147443, Type: Buffer not null terminated coverity scan CID:147656, Type: Copy into fixed size buffer coverity scan CID:147655, Type: Copy into fixed size buffer coverity scan CID:147441, Type: Buffer not null terminated coverity scan CID:147653, Type: Copy into fixed size buffer Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: liuhuang <[email protected]> Closes #5165
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c2
-rw-r--r--cmd/zinject/zinject.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index a4ffb1f44..bf9a79248 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -6768,7 +6768,7 @@ zfs_do_bookmark(int argc, char **argv)
* Snapshot name begins with @.
* Default to same fs as bookmark.
*/
- (void) strncpy(snapname, argv[1], sizeof (snapname));
+ (void) strlcpy(snapname, argv[1], sizeof (snapname));
*strchr(snapname, '#') = '\0';
(void) strlcat(snapname, argv[0], sizeof (snapname));
} else {
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c
index 0ce50277d..396c52a0c 100644
--- a/cmd/zinject/zinject.c
+++ b/cmd/zinject/zinject.c
@@ -548,7 +548,7 @@ register_handler(const char *pool, int flags, zinject_record_t *record,
{
zfs_cmd_t zc = {"\0"};
- (void) strcpy(zc.zc_name, pool);
+ (void) strlcpy(zc.zc_name, pool, sizeof (zc.zc_name));
zc.zc_inject_record = *record;
zc.zc_guid = flags;