diff options
author | наб <[email protected]> | 2022-02-16 15:29:01 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-02-18 09:34:14 -0800 |
commit | 5cf3c24fd8ada1949959deb8d511eeda9bc54e5b (patch) | |
tree | 8724255848ba6fd994fff31a64755f01d2b52aa4 /lib/libzfs | |
parent | 46c7a80280a5d36a9bc1b167ceadc316196965df (diff) |
libzfs: sendrecv: fix NULL arithmetic UB
Reviewed-by: Alejandro Colomar <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #13110
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 0f99d41e5..f6fee6074 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -294,11 +294,13 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg) uint64_t guid = zhp->zfs_dmustats.dds_guid; uint64_t txg = zhp->zfs_dmustats.dds_creation_txg; boolean_t isfromsnap, istosnap, istosnapwithnofrom; - char *snapname = strrchr(zhp->zfs_name, '@') + 1; + char *snapname; const char *from = sd->fromsnap; const char *to = sd->tosnap; - assert(snapname != (NULL + 1)); + snapname = strrchr(zhp->zfs_name, '@'); + assert(snapname != NULL); + ++snapname; isfromsnap = (from != NULL && strcmp(from, snapname) == 0); istosnap = (to != NULL && strcmp(to, snapname) == 0); |