dsl_prop_known_index(): check for invalid prop

Resolve UBSAN array-index-out-of-bounds error in zprop_desc_t.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #14142
Closes #14147
This commit is contained in:
Damian Szuberski
2022-11-09 04:16:01 +10:00
committed by Brian Behlendorf
parent 8c0684d326
commit 0f4ee295ba
2 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -75,7 +75,8 @@ static int
dsl_prop_known_index(zfs_prop_t prop, uint64_t value)
{
const char *str = NULL;
if (zfs_prop_get_type(prop) == PROP_TYPE_INDEX)
if (prop != ZPROP_CONT && prop != ZPROP_INVAL &&
zfs_prop_get_type(prop) == PROP_TYPE_INDEX)
return (!zfs_prop_index_to_string(prop, value, &str));
return (-1);