Skip to content

Commit

Permalink
zpool_load_compat() should create strings of length ZFS_MAXPROPLEN
Browse files Browse the repository at this point in the history
Otherwise, `strlcat()` can overflow them.

Coverity found this.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes openzfs#13866
  • Loading branch information
ryao authored and tonyhutter committed Nov 21, 2022
1 parent 1417fba commit 20964b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4788,8 +4788,8 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
for (uint_t i = 0; i < SPA_FEATURES; i++)
features[i] = B_TRUE;

char err_badfile[1024] = "";
char err_badtoken[1024] = "";
char err_badfile[ZFS_MAXPROPLEN] = "";
char err_badtoken[ZFS_MAXPROPLEN] = "";

/*
* We ignore errors from the directory open()
Expand Down

0 comments on commit 20964b4

Please sign in to comment.