Skip to content
Snippets Groups Projects
Commit fdb93bb9 authored by Yorhel's avatar Yorhel
Browse files

Fix use-after-free in argument parsing

Introduced in 53d3e4c1
parent d1adcde1
No related branches found
No related tags found
No related merge requests found
...@@ -429,7 +429,7 @@ pub fn main() void { ...@@ -429,7 +429,7 @@ pub fn main() void {
if (!opt.opt) { if (!opt.opt) {
// XXX: ncdu 1.x doesn't error, it just silently ignores all but the last argument. // 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", .{}); 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; continue;
} }
if (opt.is("-h") or opt.is("-?") or opt.is("--help")) help() if (opt.is("-h") or opt.is("-?") or opt.is("--help")) help()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment