Skip to content

Commit

Permalink
Fix coverity defects: CID 49339, 153393
Browse files Browse the repository at this point in the history
CID 49339: Type:Buffer not null terminated
CID 153393: Type:Buffer not null terminated

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: <cao.xuewen [email protected]>
Closes openzfs#5296
  • Loading branch information
heary-cao authored and behlendorf committed Oct 18, 2016
1 parent df74922 commit 1b81ab4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/zfs-tests/cmd/xattrtest/xattrtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 1b81ab4

Please sign in to comment.