diff options
author | Chunwei Chen <[email protected]> | 2018-02-01 16:28:11 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-02-09 10:11:19 -0800 |
commit | 5e3bd0e684a3c32bd22647938247ac3699c5372a (patch) | |
tree | cc7ad11b139e031d4820cf8e2cf262b90aaa17e2 | |
parent | 950e17c215be4e6da72a61b0431337643a82b509 (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 | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 4c0a8245f..7f2cab382 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -4235,9 +4235,11 @@ zdb_embedded_block(char *thing) { blkptr_t bp; unsigned long long *words = (void *)&bp; - char buf[SPA_MAXBLOCKSIZE]; + char *buf; int err; + 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", @@ -4256,6 +4258,7 @@ zdb_embedded_block(char *thing) exit(1); } zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0); + umem_free(buf, SPA_MAXBLOCKSIZE); } int |