From bb7a922f84354b65f2c146a197f8091dbea18238 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Tue, 13 Aug 2024 09:28:43 +0200 Subject: [PATCH] Check for non-zero buffer size in xSnprintf --- XUtils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/XUtils.c b/XUtils.c index aa9cc9e4a..94a14df64 100644 --- a/XUtils.c +++ b/XUtils.c @@ -238,6 +238,8 @@ int xAsprintf(char** strp, const char* fmt, ...) { } int xSnprintf(char* buf, size_t len, const char* fmt, ...) { + assert(len > 0); + va_list vl; va_start(vl, fmt); int n = vsnprintf(buf, len, fmt, vl);