diff options
author | Chunwei Chen <[email protected]> | 2018-02-01 16:28:11 -0800 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2018-03-14 16:10:36 -0700 |
commit | 31ff122aa2e20c7ed48617868085ddba7b4ad174 (patch) | |
tree | fe23d3f353f33409980b50bb92393f84252261bd | |
parent | 18c662b84566cd34e6f6fb982d6a01a415a4e3cd (diff) |
Fix zdb -E segfault
SPA_MAXBLOCKSIZE is too large for stack.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: loli10K <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #7099
-rw-r--r-- | cmd/zdb/zdb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 2d80589ca..90847d8d9 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -4139,11 +4139,12 @@ zdb_embedded_block(char *thing) { blkptr_t bp; unsigned long long *words = (void *)&bp; - char buf[SPA_MAXBLOCKSIZE]; + char *buf; int err; - memset(&bp, 0, sizeof (blkptr_t)); + buf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); + bzero(&bp, sizeof (bp)); err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx", words + 0, words + 1, words + 2, words + 3, @@ -4161,6 +4162,7 @@ zdb_embedded_block(char *thing) exit(1); } zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0); + umem_free(buf, SPA_MAXBLOCKSIZE); } int |