zfs/cmd/zstream
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
..
Makefile.am Add a "zstream decompress" subcommand 2022-06-24 13:28:42 -07:00
zstream.c Add a "zstream decompress" subcommand 2022-06-24 13:28:42 -07:00
zstream.h Add a "zstream decompress" subcommand 2022-06-24 13:28:42 -07:00
zstream_decompress.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zstream_dump.c Fix unreachable code in zstreamdump 2022-09-29 10:16:37 -07:00
zstream_redup.c Add a "zstream decompress" subcommand 2022-06-24 13:28:42 -07:00
zstream_token.c Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00