From 8ab2b15768050bb2c740e0e460b090ed7380b97c Mon Sep 17 00:00:00 2001 From: Dencelle Date: Fri, 13 Sep 2019 19:29:37 -0500 Subject: [PATCH 1/4] fix for telnet's lack of language skill this function is only used when a raw telnet ooc, auction, or tell is used. it needs to have the language skill set though otherwise it just comes out as garbled --- world/zonelist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 77782ee9b..9b30fb6d4 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -432,6 +432,7 @@ void ZSList::SendChannelMessageRaw(const char* from, const char* to, uint8 chan_ } scm->language = language; + scm->lang_skill = 100; scm->chan_num = chan_num; strcpy(&scm->message[0], message); From 70ad517c140285a668b692702f6b40eb2424c46f Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 16 Sep 2019 02:18:19 -0400 Subject: [PATCH 2/4] Fix for linux double free error in RestoreRuleNotes() --- common/rulesys.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 4b3599113..094780be3 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -564,16 +564,16 @@ bool RuleManager::RestoreRuleNotes(Database *db) int update_count = 0; for (auto row = results.begin(); row != results.end(); ++row) { - const auto &rule = [&row]() { + auto rule = [](const char *rule_name) { - for (const auto &rule_iter : s_RuleInfo) { - if (strcasecmp(rule_iter.name, row[1]) == 0) { + for (auto rule_iter : s_RuleInfo) { + if (strcasecmp(rule_iter.name, rule_name) == 0) { return rule_iter; } } return s_RuleInfo[_IntRuleCount+_RealRuleCount+_BoolRuleCount]; - }(); + }(row[1]); if (strcasecmp(rule.name, row[1]) != 0) { continue; From 9c95d1bfa21aaa16f2f1d1c68677f4f540cfaaef Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 16 Sep 2019 20:24:58 -0400 Subject: [PATCH 3/4] Fix for bad RestoreRuleNotes() query (thanks mackal!) --- common/rulesys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 094780be3..035cff07a 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -554,7 +554,7 @@ bool RuleManager::UpdateOrphanedRules(Database *db, bool quiet_update) bool RuleManager::RestoreRuleNotes(Database *db) { - std::string query("SELECT `ruleset_id`, `rule_name`, IFNULL(`notes`, '\\0')`notes` FROM `rule_values`"); + std::string query("SELECT `ruleset_id`, `rule_name`, `notes` FROM `rule_values`"); auto results = db->QueryDatabase(query); if (!results.Success()) { @@ -579,7 +579,7 @@ bool RuleManager::RestoreRuleNotes(Database *db) continue; } - if (rule.notes.compare(row[2]) == 0) { + if (row[2] != nullptr && rule.notes.compare(row[2]) == 0) { continue; } From d0b505f32d433d55dcf72829da1b4048334cf8d3 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 16 Sep 2019 20:39:05 -0400 Subject: [PATCH 4/4] Undefined Behavior fix... --- common/rulesys.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 035cff07a..92a209dcb 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -602,6 +602,8 @@ bool RuleManager::RestoreRuleNotes(Database *db) if (update_count > 0) { Log(Logs::General, Logs::Status, "%u Rule Note%s Restored", update_count, (update_count == 1 ? "" : "s")); } + + return true; } int RuleManager::GetRulesetID(Database *database, const char *ruleset_name) {