zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d2cb740dd952ac586a62976e692e7e5925308591 (tree)
parent 29e438fd1f77a13c3a3f128434198ac024d3e195
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon, 25 Nov 2019 01:10:30 -0500

add missing null terminator in windows file path helper function

Diffstat:
Mlib/std/child_process.zig | 1+
Mlib/std/os/windows.zig | 1+
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig @@ -441,6 +441,7 @@ pub const ChildProcess = struct { const any_ignore = (self.stdin_behavior == StdIo.Ignore or self.stdout_behavior == StdIo.Ignore or self.stderr_behavior == StdIo.Ignore); + // TODO use CreateFileW here since we are using a string literal for the path const nul_handle = if (any_ignore) windows.CreateFile( "NUL", diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig @@ -968,6 +968,7 @@ pub fn sliceToPrefixedSuffixedFileW(s: []const u8, comptime suffix: []const u16) const end_index = start_index + try std.unicode.utf8ToUtf16Le(result[start_index..], s); if (end_index + suffix.len > result.len) return error.NameTooLong; mem.copy(u16, result[end_index..], suffix); + result[end_index + suffix.len] = 0; return result; }