mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Fix coverity defects: 147480, 147584
CID 147480: Logically dead code (DEADCODE) Remove non-null check and subsequent function call. Add ASSERT to future proof the code. usage label is only jumped to before `zhp` is initialized. CID 147584: Out-of-bounds access (OVERRUN) Subtract length of current string from buffer length for `size` argument to `snprintf`. Starting address for the write is the start of the buffer + the current string length. We need to subtract this string length else risk a buffer overflow. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tobin C. Harding <me@tobin.cc> Closes #6745
This commit is contained in:
committed by
Brian Behlendorf
parent
7670f721fc
commit
ced28193b0
+1
-2
@@ -785,8 +785,7 @@ zfs_do_clone(int argc, char **argv)
|
||||
return (!!ret);
|
||||
|
||||
usage:
|
||||
if (zhp)
|
||||
zfs_close(zhp);
|
||||
ASSERT3P(zhp, ==, NULL);
|
||||
nvlist_free(props);
|
||||
usage(B_FALSE);
|
||||
return (-1);
|
||||
|
||||
Reference in New Issue
Block a user