summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-11-21 16:22:45 +0100
committerJan Kotas <jkotas@microsoft.com>2016-11-21 07:22:45 -0800
commit716cb7ea87e40abb4b106df55af7ff4666170296 (patch)
tree512ecfde277f7257c8f883715ba0b2596e415db5 /src/utilcode
parent3c3ab1a269a48b81c2a57e55da76b7e5f0f24eb9 (diff)
downloadcoreclr-716cb7ea87e40abb4b106df55af7ff4666170296.tar.gz
coreclr-716cb7ea87e40abb4b106df55af7ff4666170296.tar.bz2
coreclr-716cb7ea87e40abb4b106df55af7ff4666170296.zip
Remove unsafe banned functions (#8162)
This change removes _snwprintf, _snprintf and _vsnwprintf usage from CoreCLR and their implementations from PAL. PAL exposes their secure variants instead and CoreCLR now uses those instead. I have also removed the StringCchPrintfA/W, StringCchVPrintfA/W, StringCbVPrintfA/W, StringCbPrintfA/W, StringCbPrintfExA/W, StringCchVPrintfExA/W, StringCbVPrintfExA/W and StringCchPrintfExA/W replaced their usage by the secure variants of the sprintf functions, since they were used at only few places and implementing all of the variants using the secure sprintf variants would be a hassle. I also needed to fix a missing support for size modifiers for %p formatting character and for wide characters / strings in the secure sprintf functions that was revealed by the PAL tests. I have also removed a bunch of PAL tests that were using %n formatting character which was not implemented since it is considered unsafe and translated PAL tests that were using the removed functions to use the safe variants of those.
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/sstring.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp
index 154e9ded7a..ce532d70f6 100644
--- a/src/utilcode/sstring.cpp
+++ b/src/utilcode/sstring.cpp
@@ -2211,7 +2211,7 @@ void SString::VPrintf(const WCHAR *format, va_list args)
else
if (errno!=0 && errno!=EBADF && errno!=ERANGE)
{
- CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf failed. Potential globalization bug.");
+ CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf_s failed. Potential globalization bug.");
ThrowHR(HRESULT_FROM_WIN32(ERROR_NO_UNICODE_TRANSLATION));
}
}
@@ -2293,7 +2293,7 @@ void SString::PVPrintf(const WCHAR *format, va_list args)
else
if (errno!=0 && errno!=EBADF && errno!=ERANGE)
{
- CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf failed. Potential globalization bug.");
+ CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf_s failed. Potential globalization bug.");
ThrowHR(HRESULT_FROM_WIN32(ERROR_NO_UNICODE_TRANSLATION));
}
}