diff options
author | Neil <nyamatongwe@gmail.com> | 2020-07-17 21:49:15 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-07-17 21:49:15 +1000 |
commit | 7e11c5a4fbe6ad02c0b8e7464eef9c37b594b98c (patch) | |
tree | 9b1c89b77d0a91f77398c291a8db62f3bc69c1ea | |
parent | b3c9933350e5c6b9d06a72034e681cecae52dc4b (diff) | |
download | scintilla-mirror-7e11c5a4fbe6ad02c0b8e7464eef9c37b594b98c.tar.gz |
Fix truncation of locale due to not counting NUL. Add return code check.
-rw-r--r-- | win32/PlatWin.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index d89ae2b89..a4bda5432 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1845,8 +1845,10 @@ void ScreenLineLayout::FillTextLayoutFormats(const IScreenLine *screenLine, IDWr const unsigned int localNameSize = pfm->pTextFormat->GetLocaleNameLength(); std::vector<WCHAR> localName(localNameSize + 1); - pfm->pTextFormat->GetLocaleName(localName.data(), localNameSize); - textLayout->SetLocaleName(localName.data(), textRange); + const HRESULT hrLocale = pfm->pTextFormat->GetLocaleName(localName.data(), localNameSize + 1); + if (SUCCEEDED(hrLocale)) { + textLayout->SetLocaleName(localName.data(), textRange); + } textLayout->SetFontStretch(pfm->pTextFormat->GetFontStretch(), textRange); |