mirror_zfs/lib/libzfs
Richard Yao 67395be0c2
Fix userland dereference NULL return value bugs
* `zstream_do_token()` does not handle failures from `libzfs_init()`

 * `ztest_global_vars_to_zdb_args()` does not handle failures from
   `calloc()`.

 * `zfs_snapshot_nvl()` will pass an offset to a NULL pointer as a
   source to `strlcpy()` if the provided nvlist is `NULL`.

We handle these by doing what the existing error handling does for other
errors involving these functions.

Coverity complained about these. It had complained about several more,
but one was fixed by 570ca4441e and
another was a false positive. The remaining complaints labelled
"dereferece null return vaue" involve fetching things stored in
in-kernel data structures via `list_head()/list_next()`,
`AVL_PREV()/AVL_NEXT()` and `zfs_btree_find()`. Most of them occur in
void functions that have no error handling. They are much harder to
analyze than the two fixed in this patch, so they are left for a
follow-up patch.

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 #13971
2022-09-30 17:02:57 -07:00
..
os Fix unsafe string operations 2022-09-27 16:47:24 -07:00
.gitignore Clean up lib dependencies 2020-07-10 14:26:00 -07:00
libzfs_changelist.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_config.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_crypto.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
libzfs_dataset.c Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
libzfs_diff.c Cleanup: Switch to strlcpy from strncpy 2022-09-27 16:35:29 -07:00
libzfs_impl.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_import.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_iter.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_mount.c Make zfs-share service resilient to stale exports 2022-09-09 10:54:16 -07:00
libzfs_pool.c zed: mark disks as REMOVED when they are removed 2022-09-28 09:48:46 -07:00
libzfs_sendrecv.c Fix unsafe string operations 2022-09-27 16:47:24 -07:00
libzfs_status.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_util.c Enforce "-F" flag on resuming recv of full/newfs on existing dataset 2022-09-27 16:34:27 -07:00
libzfs.abi zed: mark disks as REMOVED when they are removed 2022-09-28 09:48:46 -07:00
libzfs.pc.in Spruce up pkg-config files for libzfs/libzfs_core 2020-09-04 11:11:18 -07:00
libzfs.suppr Library ABI tracking with abigail 2020-11-17 09:18:52 -08:00
Makefile.am Replace EXTRA_DIST with dist_noinst_DATA 2022-05-26 09:24:50 -07:00
THIRDPARTYLICENSE.openssl Fix typos in lib/ 2019-09-02 17:53:27 -07:00
THIRDPARTYLICENSE.openssl.descrip Encryption patch follow-up 2017-10-11 16:54:48 -04:00