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);