From 8724904a1f84d4eed9f7e99ccf33454f28ce7a34 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 12 Nov 2022 09:57:29 +0000 Subject: [PATCH] Avoid out of bound shift in NetworkCompanyIsPassworded(COMPANY_SPECTATOR) --- src/network/network.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/network.cpp b/src/network/network.cpp index 48f7fd991f..28f0f75bf9 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -226,7 +226,7 @@ std::string GenerateCompanyPasswordHash(const std::string &password, const std:: */ 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,