correctly declare log functions and fix potential formatstring injection

This commit is contained in:
LordMZTE 2024-01-06 09:49:35 +01:00
parent ac3412155c
commit 0c5fc7b1f8
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
3 changed files with 9 additions and 3 deletions

View file

@ -39,5 +39,5 @@ fn syslog(
};
var buf: [1024]u8 = undefined;
const str = try fmt.bufPrintZ(&buf, format, args);
c.syslog(priority, str.ptr);
c.syslog(priority, "%s", str.ptr);
}

View file

@ -6,7 +6,10 @@ const debug = std.debug;
const io = std.io;
const meta = std.meta;
pub const log = @import("log.zig").log;
pub const std_options = struct {
pub const logFn = @import("log.zig").log;
};
const logger = std.log.scoped(.wayprompt);
const Frontend = @import("Frontend.zig");

View file

@ -9,7 +9,10 @@ const fmt = std.fmt;
const heap = std.heap;
const debug = std.debug;
pub const log = @import("log.zig").log;
pub const std_options = struct {
pub const logFn = @import("log.zig").log;
};
const logger = std.log.scoped(.wayprompt);
var use_syslog = &@import("log.zig").use_syslog;