mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[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:
+11
-22
@@ -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;
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
|
||||
ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0);
|
||||
ZoneRepository::Zone *GetZone(const char *in_zone_name);
|
||||
ZoneRepository::Zone *GetZone(std::string in_zone_name);
|
||||
uint32 GetZoneID(const char *in_zone_name);
|
||||
uint32 GetZoneID(std::string zone_name);
|
||||
std::string GetZoneName(uint32 zone_id);
|
||||
|
||||
Reference in New Issue
Block a user