authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-25 01:10:30-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-25 01:10:30-05:00
logd2cb740dd952ac586a62976e692e7e5925308591
tree35c8d2cb336c24ee059d49f60de422f520aa4164
parent29e438fd1f77a13c3a3f128434198ac024d3e195

add missing null terminator in windows file path helper function


2 files changed, 2 insertions(+), 0 deletions(-)

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