From 5174e6b8addd6d26635d365c7d7a977aa6697140 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Thu, 29 Jun 2023 17:28:22 +0300 Subject: [PATCH] side-stepped weird snprintf bug --- libs/drawtext/draw.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/libs/drawtext/draw.c b/libs/drawtext/draw.c index 08047c1..dec6101 100644 --- a/libs/drawtext/draw.c +++ b/libs/drawtext/draw.c @@ -90,24 +90,14 @@ void dtx_substring(const char *str, int start, int end) void dtx_printf(const char *fmt, ...) { va_list ap; - int buf_size; - char *buf, tmp; + static char buf[1024]; if(!dtx_font) { return; } va_start(ap, fmt); - buf_size = vsnprintf(&tmp, 0, fmt, ap); - va_end(ap); - - if(buf_size == -1) { - buf_size = 512; - } - - buf = alloca(buf_size + 1); - va_start(ap, fmt); - vsnprintf(buf, buf_size + 1, fmt, ap); + vsnprintf(buf, sizeof buf, fmt, ap); va_end(ap); dtx_string(buf); -- 1.7.10.4