diff options
author | Yorhel <git@yorhel.nl> | 2021-10-06 14:06:48 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-10-06 14:06:50 +0200 |
commit | fdb93bb9e646fad0c763be43a53c11b2543bdcbe (patch) | |
tree | 292a4c2ab7d5dc1ff7b7bfe01688f00b7b546b8d | |
parent | d1adcde15cad6686ba460244f6ce41f49395ca90 (diff) |
Fix use-after-free in argument parsing
Introduced in 53d3e4c112a475ecbaae42cc1e58d42b986d76fc
-rw-r--r-- | src/main.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig index b8f19a5..bf210dc 100644 --- a/src/main.zig +++ b/src/main.zig @@ -429,7 +429,7 @@ pub fn main() void { if (!opt.opt) { // XXX: ncdu 1.x doesn't error, it just silently ignores all but the last argument. if (scan_dir != null) ui.die("Multiple directories given, see ncdu -h for help.\n", .{}); - scan_dir = opt.val; + scan_dir = allocator.dupeZ(u8, opt.val) catch unreachable; continue; } if (opt.is("-h") or opt.is("-?") or opt.is("--help")) help() |