mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 06:05:58 +01:00
util/log: fix buffer overflow
This commit is contained in:
parent
c68c9f1685
commit
21e96c459d
1 changed files with 3 additions and 2 deletions
|
@ -72,8 +72,9 @@ static wlr_log_func_t log_callback = log_stderr;
|
||||||
static void log_wl(const char *fmt, va_list args) {
|
static void log_wl(const char *fmt, va_list args) {
|
||||||
static char wlr_fmt[1024];
|
static char wlr_fmt[1024];
|
||||||
int n = snprintf(wlr_fmt, sizeof(wlr_fmt), "[wayland] %s", fmt);
|
int n = snprintf(wlr_fmt, sizeof(wlr_fmt), "[wayland] %s", fmt);
|
||||||
if (n > 0 && wlr_fmt[n - 1] == '\n') {
|
size_t len = strlen(wlr_fmt);
|
||||||
wlr_fmt[n - 1] = '\0';
|
if (n > 0 && wlr_fmt[len - 1] == '\n') {
|
||||||
|
wlr_fmt[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
_wlr_vlog(WLR_INFO, wlr_fmt, args);
|
_wlr_vlog(WLR_INFO, wlr_fmt, args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue