mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
bug: std.os.realpath on non-windows asserts no nulls, make an error
This commit is contained in:

committed by
Mitchell Hashimoto

parent
739fc746bf
commit
28ff9f7310
@ -75,6 +75,12 @@ pub const LoadingImage = struct {
|
||||
log.warn("failed to decode base64 data: {}", .{err});
|
||||
return error.InvalidData;
|
||||
};
|
||||
|
||||
if (builtin.os != .windows and std.mem.indexOfScalar(u8, buf[0..size], 0) == null) {
|
||||
// std.os.realpath *asserts* that the path does not have internal nulls instead of erroring.
|
||||
log.warn("failed to get absolute path: BadPathName", .{});
|
||||
return error.InvalidData;
|
||||
}
|
||||
var abs_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = std.os.realpath(buf[0..size], &abs_buf) catch |err| {
|
||||
log.warn("failed to get absolute path: {}", .{err});
|
||||
|
Reference in New Issue
Block a user