HomeFreeBSD

zpool_valid_proplist() should not corrupt nvpair name string on error

Description

zpool_valid_proplist() should not corrupt nvpair name string on error

The strings returned from parsing nvlists should be immutable, but to
simplify the code when we want a substring from it, we sometimes will
write a NULL into it and then restore the value afterward. Provided
there is no concurrent access, this is okay, unless we forget to restore
the value afterward. This was caught when constifying string functions
related to nvlists.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14612

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Mar 11 2023, 8:25 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 14 2023, 10:25 PM
Parents
rG27ff18cd43aa: Fix possible NULL pointer dereference in nvlist_lookup_nvpair_ei_sep()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG47a706277276: zpool_valid_proplist() should not corrupt nvpair name string on error (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Mar 14 2023, 10:25 PM