From c8b7e114414029ea686dfd4bc4feb4180b0d2c6d Mon Sep 17 00:00:00 2001 From: Eibz-Chan <111971485+Eibz-Chan@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:28:21 +0800 Subject: [PATCH] Unsafe function usage High Risk to use vsprintf(). It must be replaced by vsnprintf. --- vasprintf_compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vasprintf_compat.h b/vasprintf_compat.h index 59b2e96..5012bfc 100644 --- a/vasprintf_compat.h +++ b/vasprintf_compat.h @@ -51,7 +51,7 @@ static int vasprintf(char **buf, const char *fmt, va_list ap) return -1; } - if ((chars = vsprintf(b, fmt, ap)) < 0) + if ((chars = vsnprintf(b, ((size_t)chars + 1), fmt, ap)) < 0) { free(b); }