Fix coverity defects: CID 49339, 153393

CID 49339: Type:Buffer not null terminated
CID 153393: Type:Buffer not null terminated

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: <cao.xuewen cao.xuewen@zte.com.cn>
Closes #5296
This commit is contained in:
cao 2016-10-19 01:31:57 +08:00 committed by Brian Behlendorf
parent df7492240a
commit 1b81ab46d0
2 changed files with 3 additions and 1 deletions

View File

@ -553,7 +553,7 @@ zfs_userspace_one(zfs_sb_t *zsb, zfs_userquota_prop_t type,
return (0);
if (type == ZFS_PROP_USEROBJUSED || type == ZFS_PROP_GROUPOBJUSED) {
strncpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN);
strlcpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN);
offset = DMU_OBJACCT_PREFIX_LEN;
}

View File

@ -168,6 +168,7 @@ parse_args(int argc, char **argv)
break;
case 'p':
strncpy(path, optarg, PATH_MAX);
path[PATH_MAX - 1] = '\0';
break;
case 'c':
synccaches = 1;
@ -177,6 +178,7 @@ parse_args(int argc, char **argv)
break;
case 't':
strncpy(script, optarg, PATH_MAX);
script[PATH_MAX - 1] = '\0';
break;
case 'e':
seed = strtol(optarg, NULL, 0);