From f1c91f140d05c29a79aa195cff6a3c18a32975d6 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Fri, 19 Sep 2008 10:35:30 +0000 Subject: [PATCH] - Get rid of sprintf usage in default_dbg_vprintf. - This make tracing macro usage safe in crt sprintf implementation and simplify overall codepath (no need for intermediate buffer). - Solution inspired by hackbunny's suggestion, fixes bug 3632. - Add vDbgPrintExWithPrefix to debugsup libraries. See issue #3632 for more details. svn path=/trunk/; revision=36323 --- reactos/lib/3rdparty/libwine/debug.c | 18 +++++++++--------- reactos/lib/debugsup/debugsup-ntos.def | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/reactos/lib/3rdparty/libwine/debug.c b/reactos/lib/3rdparty/libwine/debug.c index 2ed8d942f42..acf4d8289cf 100644 --- a/reactos/lib/3rdparty/libwine/debug.c +++ b/reactos/lib/3rdparty/libwine/debug.c @@ -36,11 +36,14 @@ #include ULONG -__cdecl -DbgPrint( - IN PCCH Format, - IN ... -); +NTAPI +vDbgPrintExWithPrefix( + IN LPCSTR Prefix, + IN ULONG ComponentId, + IN ULONG Level, + IN LPCSTR Format, + IN va_list ap); + static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" }; @@ -387,10 +390,7 @@ static const char *default_dbgstr_wn( const WCHAR *str, int n ) /* default implementation of wine_dbg_vprintf */ static int default_dbg_vprintf( const char *format, va_list args ) { - char buffer[512]; - vsnprintf( buffer, sizeof(buffer), format, args ); - buffer[sizeof(buffer) - 1] = '\0'; - return DbgPrint( "%s", buffer ); + return vDbgPrintExWithPrefix("", -1, 0, format, args); } diff --git a/reactos/lib/debugsup/debugsup-ntos.def b/reactos/lib/debugsup/debugsup-ntos.def index 74763e187e1..6c6164c6b64 100644 --- a/reactos/lib/debugsup/debugsup-ntos.def +++ b/reactos/lib/debugsup/debugsup-ntos.def @@ -4,6 +4,7 @@ DbgBreakPointWithStatus@4 DbgPrint DbgPrompt@12 DbgPrintEx +vDbgPrintExWithPrefix@20 RtlAssert@16 RtlUnwind@16