mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed a crash bug in FullItemDescInBarter
* when weapon/ammo has no description, it'd trigger UB from strncpy_s.
This commit is contained in:
@@ -1693,6 +1693,9 @@ static bool showItemDescription = false;
|
||||
|
||||
static void __stdcall AppendText(const char* text, const char* desc) {
|
||||
if (showItemDescription && currDescLen == 0) {
|
||||
if (desc == nullptr) {
|
||||
desc = fo::util::MessageSearch(&fo::var::proto_main_msg_file, 493);
|
||||
}
|
||||
strncpy_s(messageBuffer, desc, 161);
|
||||
int len = strlen(messageBuffer);
|
||||
if (len > 160) {
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ std::vector<std::string> Translate::GetList(const char* section, const char* set
|
||||
|
||||
static void MakeLangTranslationPath(const char* config) {
|
||||
char patches[65], language[32];
|
||||
char fileConfig[65] = ".\\";
|
||||
char fileConfig[67] = ".\\";
|
||||
std::strcpy(&fileConfig[2], config);
|
||||
|
||||
IniReader::GetString("system", "language", "english", language, 32, fileConfig);
|
||||
@@ -74,7 +74,7 @@ static void InitMessagesTranslate() {
|
||||
combatBlockedMessage = Translate::Get("sfall", "BlockedCombat", "You cannot enter combat at this time.");
|
||||
combatSaveFailureMsg = Translate::Get("sfall", "SaveInCombat", "Cannot save at this time.");
|
||||
saveSfallDataFailMsg = Translate::Get("sfall", "SaveSfallDataFail", "ERROR saving extended savegame information! "
|
||||
"Check if other programs interfere with savegame files/folders and try again!");
|
||||
"Check if other programs interfere with savegame files/folders and try again.");
|
||||
}
|
||||
|
||||
void Translate::init(const char* config) {
|
||||
|
||||
Reference in New Issue
Block a user