summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-12-23 14:41:28 +0100
committerJan Kotas <jkotas@microsoft.com>2016-12-23 05:41:28 -0800
commitf5cbe4c9cab2873b60cd3c991732a250d2e164a2 (patch)
tree3dfef3ef56990e19fb914821ed4e6f36c9931fd1 /src/gc
parent5ef3df8ffe059d5f91c6bae09d8f95a0332f1363 (diff)
downloadcoreclr-f5cbe4c9cab2873b60cd3c991732a250d2e164a2.tar.gz
coreclr-f5cbe4c9cab2873b60cd3c991732a250d2e164a2.tar.bz2
coreclr-f5cbe4c9cab2873b60cd3c991732a250d2e164a2.zip
Remove all usage of vsnprintf (#8709)
This change removes all usages of vsnprintf and modifies runtime to not to use vsnprintf or _vsnprintf I've also fixed two issues in PAL TRACE function string format parameters that caused crashes when I was trying to run all PAL tests with PAL tracing enabled.
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/env/gcenv.base.h2
-rw-r--r--src/gc/gc.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h
index 94f73762f8..0a0de73ee1 100644
--- a/src/gc/env/gcenv.base.h
+++ b/src/gc/env/gcenv.base.h
@@ -96,7 +96,7 @@ inline HRESULT HRESULT_FROM_WIN32(unsigned long x)
#define UNREFERENCED_PARAMETER(P) (void)(P)
#ifdef PLATFORM_UNIX
-#define _vsnprintf vsnprintf
+#define _vsnprintf_s(string, sizeInBytes, count, format, args) vsnprintf(string, sizeInBytes, format, args)
#define sprintf_s snprintf
#define swprintf_s swprintf
#endif
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 6187938ff8..586da23527 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -389,7 +389,7 @@ void log_va_msg(const char *fmt, va_list args)
int pid_len = sprintf_s (&pBuffer[buffer_start], BUFFERSIZE - buffer_start, "[%5d]", (uint32_t)GCToOSInterface::GetCurrentThreadIdForLogging());
buffer_start += pid_len;
memset(&pBuffer[buffer_start], '-', BUFFERSIZE - buffer_start);
- int msg_len = _vsnprintf(&pBuffer[buffer_start], BUFFERSIZE - buffer_start, fmt, args );
+ int msg_len = _vsnprintf_s(&pBuffer[buffer_start], BUFFERSIZE - buffer_start, _TRUNCATE, fmt, args );
if (msg_len == -1)
{
msg_len = BUFFERSIZE - buffer_start;