mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-21 19:55:00 +00:00
Backport: Fix possible overflow with 5-digit+ UIDs
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -213,7 +213,7 @@ fn setXdgEnv(tty_str: [:0]u8, maybe_desktop_name: ?[:0]const u8, maybe_xdg_deskt
|
|||||||
// directory.
|
// directory.
|
||||||
if (builtin.os.tag != .freebsd) {
|
if (builtin.os.tag != .freebsd) {
|
||||||
const uid = interop.unistd.getuid();
|
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});
|
const uid_str = try std.fmt.bufPrintZ(&uid_buffer, "/run/user/{d}", .{uid});
|
||||||
|
|
||||||
_ = interop.stdlib.setenv("XDG_RUNTIME_DIR", uid_str, 0);
|
_ = interop.stdlib.setenv("XDG_RUNTIME_DIR", uid_str, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user