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 | ca1a5ea845c283a9c84fd2ae9f6d152cca354183 (patch) | |
tree | d851b7c06cc7763849d504b58797199c9032b441 /win32/PlatWin.cxx | |
parent | 0b56a6704d1c64644d5bfef318806f8490d649ec (diff) | |
download | scintilla-mirror-ca1a5ea845c283a9c84fd2ae9f6d152cca354183.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(); |