zpool_load_compat() should create strings of length ZFS_MAXPROPLEN

Otherwise, `strlcat()` can overflow them.

Coverity found this.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13866
This commit is contained in:
Richard Yao 2022-09-12 15:54:43 -04:00 committed by Tony Hutter
parent ab22031d79
commit 792825724b
1 changed files with 2 additions and 2 deletions

View File

@ -4788,8 +4788,8 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
for (uint_t i = 0; i < SPA_FEATURES; i++) for (uint_t i = 0; i < SPA_FEATURES; i++)
features[i] = B_TRUE; features[i] = B_TRUE;
char err_badfile[1024] = ""; char err_badfile[ZFS_MAXPROPLEN] = "";
char err_badtoken[1024] = ""; char err_badtoken[ZFS_MAXPROPLEN] = "";
/* /*
* We ignore errors from the directory open() * We ignore errors from the directory open()