diff options
author | Richard Yao <[email protected]> | 2022-10-14 16:33:22 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-12-01 12:39:41 -0800 |
commit | d016ca1a92037bb956f8ff749da9e3e48ba16323 (patch) | |
tree | 783023ae7282e8f9c44e10af6a20f6c943129485 /lib | |
parent | d05f247aece91500e5a1883e6fbdee66adde171f (diff) |
Fix potential NULL pointer dereference in lzc_ioctl()
Users are allowed to pass NULL to resultp, but we unconditionally assume
that they never do. When an external user does pass NULL to resultp, we
dereference a NULL pointer.
Clang's static analyzer complained about this.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14008
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs_core/libzfs_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libzfs_core/libzfs_core.c b/lib/libzfs_core/libzfs_core.c index 1e6bbcd56..855d8cb0a 100644 --- a/lib/libzfs_core/libzfs_core.c +++ b/lib/libzfs_core/libzfs_core.c @@ -233,7 +233,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, break; } } - if (zc.zc_nvlist_dst_filled) { + if (zc.zc_nvlist_dst_filled && resultp != NULL) { *resultp = fnvlist_unpack((void *)(uintptr_t)zc.zc_nvlist_dst, zc.zc_nvlist_dst_size); } |