terminal: fix use-after-free in exec
This was only an issue on Linux, as MacOS' command is reallocated and rewritten. We hit this using embedded Ghostty w/o a login shell :ppull/8358/head
parent
0c722b0e3d
commit
652f6f1deb
|
|
@ -1513,7 +1513,8 @@ fn execCommand(
|
|||
}
|
||||
|
||||
return switch (command) {
|
||||
.direct => |v| v,
|
||||
// We need to clone the command since there's no guarantee the config remains valid.
|
||||
.direct => |_| (try command.clone(alloc)).direct,
|
||||
|
||||
.shell => |v| shell: {
|
||||
var args: std.ArrayList([:0]const u8) = try .initCapacity(alloc, 4);
|
||||
|
|
|
|||
Loading…
Reference in New Issue