[Crash] Stability Fixes (#2489)

* Input sanitation for #zone

* Update zone.cpp

* Update clientlist.cpp

* Test

* Test

* Remove logging, revert /who all code

* Remove log

* Update clientlist.cpp
This commit is contained in:
Chris Miles
2022-10-15 15:17:50 -05:00
committed by GitHub
parent bbbebdd346
commit 7092183103
5 changed files with 66 additions and 48 deletions
+11 -22
View File
@@ -82,22 +82,6 @@ const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
return "UNKNOWN";
}
LogInfo(
"[GetZoneName] Failed to get zone name by zone_id [{}] error_unknown [{}] printing stack",
zone_id,
(error_unknown ? "true" : "false")
);
// print stack when invalid input
if (zone_id == 0) {
backward::StackTrace st;
backward::TraceResolver e = {};
st.load_here(32);
backward::Printer p;
p.print(st);
}
return nullptr;
}
@@ -118,12 +102,6 @@ const char *ZoneStore::GetZoneLongName(uint32 zone_id, bool error_unknown)
return "UNKNOWN";
}
LogInfo(
"[GetZoneLongName] Failed to get zone long name by zone_id [{}] error_unknown [{}]",
zone_id,
(error_unknown ? "true" : "false")
);
return nullptr;
}
@@ -196,6 +174,17 @@ ZoneRepository::Zone *ZoneStore::GetZone(const char *in_zone_name)
return nullptr;
}
ZoneRepository::Zone *ZoneStore::GetZone(std::string in_zone_name)
{
for (auto &z: m_zones) {
if (z.short_name == in_zone_name) {
return &z;
}
}
return nullptr;
}
const std::vector<ZoneRepository::Zone> &ZoneStore::GetZones() const
{
return m_zones;