mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
zstreamdump dumps core printing truncated nvlist
This change prevents zstreamdump from crashing when trying to print invalid nvlist data (DRR_BEGIN record) from a truncated send stream. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #7917
This commit is contained in:
parent
81155b296d
commit
e0b7ff46c9
@ -384,10 +384,12 @@ main(int argc, char *argv[])
|
||||
if (ferror(send_stream))
|
||||
perror("fread");
|
||||
err = nvlist_unpack(buf, sz, &nv, 0);
|
||||
if (err)
|
||||
if (err) {
|
||||
perror(strerror(err));
|
||||
nvlist_print(stdout, nv);
|
||||
nvlist_free(nv);
|
||||
} else {
|
||||
nvlist_print(stdout, nv);
|
||||
nvlist_free(nv);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user