Skip to content

Commit

Permalink
Realm: Add safeguard against Id 0 for realmlist id
Browse files Browse the repository at this point in the history
0 is being used as a placeholder by realmd for logging
  • Loading branch information
killerwife committed Jul 24, 2024
1 parent 7b6f9a4 commit a364c15
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/realmd/RealmList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ void RealmList::UpdateRealms(bool init)
uint8 realmflags = fields[5].GetUInt8();
uint8 allowedSecurityLevel = fields[7].GetUInt8();

if (Id == 0)
{
sLog.outErrorDb("Realm ID must be > 0", Id, name.c_str());
continue;
}

if (realmflags & ~(REALM_FLAG_OFFLINE | REALM_FLAG_NEW_PLAYERS | REALM_FLAG_RECOMMENDED | REALM_FLAG_SPECIFYBUILD))
{
sLog.outError("Realm (id %u, name '%s') can only be flagged as OFFLINE (mask 0x02), NEWPLAYERS (mask 0x20), RECOMMENDED (mask 0x40), or SPECIFICBUILD (mask 0x04) in DB", Id, name.c_str());
Expand Down

0 comments on commit a364c15

Please sign in to comment.