From bff91409954bd5962573da7077b51288b3f7bdf7 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 26 Oct 2021 17:57:26 +0200 Subject: [PATCH] Expand buffers to handle Bulgarian translation --- Source/items.cpp | 10 +++++----- Source/minitext.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index c365c502e..0ee091aec 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1314,12 +1314,12 @@ void GetStaffSpell(Item &item, int lvl, bool onlygood) s = SPL_FIREBOLT; } - char istr[68]; - strcpy(istr, fmt::format(_("{:s} of {:s}"), item._iName, pgettext("spell", spelldata[bs].sNameText)).c_str()); + char istr[68] = {}; + strncpy(istr, fmt::format(_("{:s} of {:s}"), item._iName, pgettext("spell", spelldata[bs].sNameText)).c_str(), sizeof(istr) - 1); if (!StringInPanel(istr)) - strcpy(istr, fmt::format(_("Staff of {:s}"), pgettext("spell", spelldata[bs].sNameText)).c_str()); - strcpy(item._iName, istr); - strcpy(item._iIName, istr); + strncpy(istr, fmt::format(_("Staff of {:s}"), pgettext("spell", spelldata[bs].sNameText)).c_str(), sizeof(istr) - 1); + strncpy(item._iName, istr, sizeof(item._iName) - 1); + strncpy(item._iIName, istr, sizeof(item._iIName) - 1); int minc = spelldata[bs].sStaffMin; int maxc = spelldata[bs].sStaffMax - minc + 1; diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 83d7e21b3..b69be57b6 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -41,7 +41,7 @@ void LoadText(const char *text) { TextLines.clear(); - char tempstr[2048]; + char tempstr[2560]; strcpy(tempstr, text); const std::string paragraphs = WordWrapString(tempstr, 543, GameFont30);