Skip to content

Commit 19516b6

Browse files
authored
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 <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14008
1 parent 4d5aef3 commit 19516b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/libzfs_core/libzfs_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name,
235235
break;
236236
}
237237
}
238-
if (zc.zc_nvlist_dst_filled) {
238+
if (zc.zc_nvlist_dst_filled && resultp != NULL) {
239239
*resultp = fnvlist_unpack((void *)(uintptr_t)zc.zc_nvlist_dst,
240240
zc.zc_nvlist_dst_size);
241241
}

0 commit comments

Comments
 (0)