diff options
author | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 |
commit | dac5800933977672e8d2d67854a97a517abbe47d (patch) | |
tree | c057a54cf4b5f01be58cc5042ee30043a2363ba6 /win32/PlatWin.cxx | |
parent | 3f4549e26cb8182fa236ea3c8a08c20a71e4da38 (diff) | |
download | scintilla-mirror-dac5800933977672e8d2d67854a97a517abbe47d.tar.gz |
Avoid unsafe strcpy, strncpy, and strcat replacing with safer functions which
guaranty termination where possible.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index d2bc4c05f..90deb44e3 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -36,8 +36,9 @@ #endif #include "Platform.h" -#include "UniConversion.h" +#include "StringCopy.h" #include "XPM.h" +#include "UniConversion.h" #include "FontQuality.h" #ifndef IDC_HAND @@ -307,8 +308,7 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, flo lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0); lf.lfCharSet = static_cast<BYTE>(characterSet); lf.lfQuality = Win32MapFontQuality(extraFontFlag); - strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName)); - lf.lfFaceName[sizeof(lf.lfFaceName)-1] = '\0'; + StringCopy(lf.lfFaceName, faceName); } /** @@ -3214,7 +3214,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); + sprintf(buffer, "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n"); if (assertionPopUps) { int idButton = ::MessageBoxA(0, buffer, "Assertion failure", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); @@ -3226,7 +3226,6 @@ void Platform::Assert(const char *c, const char *file, int line) { abort(); } } else { - strcat(buffer, "\r\n"); Platform::DebugDisplay(buffer); ::DebugBreak(); abort(); |