mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Fix possible overflow with 5-digit+ UIDs (c.f. #684)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -211,7 +211,7 @@ fn setXdgEnv(tty_str: [:0]u8, environment: Environment) !void {
|
||||
// directory.
|
||||
if (builtin.os.tag != .freebsd) {
|
||||
const uid = interop.unistd.getuid();
|
||||
var uid_buffer: [10 + @sizeOf(u32) + 1]u8 = undefined;
|
||||
var uid_buffer: [32]u8 = undefined; // No UID can be larger than this
|
||||
const uid_str = try std.fmt.bufPrintZ(&uid_buffer, "/run/user/{d}", .{uid});
|
||||
|
||||
_ = interop.stdlib.setenv("XDG_RUNTIME_DIR", uid_str, 0);
|
||||
|
||||
Reference in New Issue
Block a user