From 28dd9502f166df8ab74438c8d2eb8369b947ee27 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Tue, 20 Apr 2021 20:57:01 -0400 Subject: [PATCH] winsyslog: prevent buffer overrun on when copying formatted strings The Windows vsyslog emulation is somewhat archaic and assumes that the log line while max out at 1024 characters, which is not the case nowadays. Using vsnprintf instead vsprintf, will truncate the copy instead of writing outside the buffer. Change-Id: I6a6176fd79eeaf663d2cb9396715babe5254a6e2 --- src/winsyslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winsyslog.c b/src/winsyslog.c index fd86982d9f..a9ec4984b9 100644 --- a/src/winsyslog.c +++ b/src/winsyslog.c @@ -83,7 +83,7 @@ void closelog(void) CONST CHAR *arr[1]; char tmp[1024]; - vsprintf(tmp, format, arglist); + vsnprintf(tmp, 1024, format, arglist); #ifndef RING_UWP arr[0] = tmp; -- GitLab