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:
@@ -1677,6 +1677,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::ptr::proto_main_msg_file, 493);
|
||||
}
|
||||
strncpy_s(messageBuffer, desc, 161);
|
||||
int len = strlen(messageBuffer);
|
||||
if (len > 160) {
|
||||
|
||||
+2
-2
@@ -51,7 +51,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);
|
||||
@@ -76,7 +76,7 @@ static void InitMessagesTranslate() {
|
||||
Translate::Get("sfall", "BlockedCombat", "You cannot enter combat at this time.", combatBlockedMessage);
|
||||
Translate::Get("sfall", "SaveInCombat", "Cannot save at this time.", combatSaveFailureMsg);
|
||||
Translate::Get("sfall", "SaveSfallDataFail", "ERROR saving extended savegame information! "
|
||||
"Check if other programs interfere with savegame files/folders and try again!", saveSfallDataFailMsg);
|
||||
"Check if other programs interfere with savegame files/folders and try again.", saveSfallDataFailMsg);
|
||||
}
|
||||
|
||||
void Translate::init(const char* config) {
|
||||
|
||||
Reference in New Issue
Block a user