Avoid out of bound shift in NetworkCompanyIsPassworded(COMPANY_SPECTATOR)

This commit is contained in:
Jonathan G Rennison
2022-11-12 09:57:29 +00:00
parent 2b5456a664
commit 8724904a1f

View File

@@ -226,7 +226,7 @@ std::string GenerateCompanyPasswordHash(const std::string &password, const std::
*/ */
bool NetworkCompanyIsPassworded(CompanyID company_id) bool NetworkCompanyIsPassworded(CompanyID company_id)
{ {
return HasBit(_network_company_passworded, company_id); return company_id < MAX_COMPANIES && HasBit(_network_company_passworded, company_id);
} }
/* This puts a text-message to the console, or in the future, the chat-box, /* This puts a text-message to the console, or in the future, the chat-box,