From ccda264648e4bba3739f348bfb88d0ac2ebfddfe Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 17 Aug 2021 01:34:42 -0400 Subject: [PATCH] [common] windebug: pass FORMAT_MESSAGE_IGNORE_INSERTS to FormatMessage This avoids problems when the error message we are told to format contains inserts like %1. See https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353 for details (or for fun). --- common/src/platform/windows/windebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/platform/windows/windebug.c b/common/src/platform/windows/windebug.c index 99b599dd..c66c1c3b 100644 --- a/common/src/platform/windows/windebug.c +++ b/common/src/platform/windows/windebug.c @@ -25,7 +25,7 @@ void DebugWinError(const char * file, const unsigned int line, const char * func { char *buffer; FormatMessageA( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, status, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),