discover_cached_paths() should not corrupt nvlist string value
commit50f6934b9c1f4aa583592e8a969b934440a44c64
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Sun, 12 Mar 2023 16:30:21 +0000 (12 12:30 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 14 Mar 2023 22:25:45 +0000 (14 15:25 -0700)
tree61ef272153282654eb574fd73e7d440207802bab
parent47a7062772766c8a532df157a7be681327c20ea6
discover_cached_paths() should not corrupt nvlist string value

discover_cached_paths() will write a NULL into a string from a nvlist to
use it as a substring, but does not restore it before return. This
corrupts the nvlist. It should be harmless unless the string is needed
again later, but we should not do this, so let us fix it.

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
lib/libzutil/zutil_import.c