diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-11-21 13:41:10 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-11-21 13:41:10 -0500 |
| commit | b953e322a857e58df2209ca7ae9e965b9e768887 (patch) | |
| tree | a459e7a948da5b040619c52e345edf89e120e327 | |
| parent | a69695a28c418924a13e2b8bd370fa3b86fef596 (diff) | |
| download | zig-b953e322a857e58df2209ca7ae9e965b9e768887.tar.gz zig-b953e322a857e58df2209ca7ae9e965b9e768887.zip | |
std.os.path.realC: make overflow more clearly impossible
| -rw-r--r-- | std/os/path.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/std/os/path.zig b/std/os/path.zig index b3cfec1a3a..0d636353a8 100644 --- a/std/os/path.zig +++ b/std/os/path.zig @@ -1183,7 +1183,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro const fd = try os.posixOpenC(pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0); defer os.close(fd); - var buf: ["/proc/self/fd/-2147483648".len]u8 = undefined; + var buf: ["/proc/self/fd/-2147483648\x00".len]u8 = undefined; const proc_path = fmt.bufPrint(buf[0..], "/proc/self/fd/{}\x00", fd) catch unreachable; return os.readLinkC(out_buffer, proc_path.ptr); |
