From 151e7fe37bbe9c115ba4115a598b40e4fb3f4a95 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 6 Feb 2025 21:19:10 +0300 Subject: [PATCH] public: crtlib: check for empty buffer in Q_vsnprintf --- public/crtlib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/crtlib.c b/public/crtlib.c index 8455aa19..6baebb33 100644 --- a/public/crtlib.c +++ b/public/crtlib.c @@ -339,6 +339,9 @@ int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list ar { int result; + if( unlikely( buffersize == 0 )) + return -1; // report as overflow + #ifndef _MSC_VER result = vsnprintf( buffer, buffersize, format, args ); #else