mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-08 23:19:40 +00:00
(svn r19613) -Fix [FS#3755]: possible invalid read when server moves client to spectators before he finishes joining
This commit is contained in:
parent
7590651aea
commit
24a60b77ec
@ -779,10 +779,12 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_PASSWORD)
|
|||||||
char password[NETWORK_PASSWORD_LENGTH];
|
char password[NETWORK_PASSWORD_LENGTH];
|
||||||
p->Recv_string(password, sizeof(password));
|
p->Recv_string(password, sizeof(password));
|
||||||
|
|
||||||
/* Check company password. Allow joining if we cleared the password meanwhile */
|
/* Check company password. Allow joining if we cleared the password meanwhile.
|
||||||
const NetworkClientInfo *ci = cs->GetInfo();
|
* Also, check the company is still valid - client could be moved to spectators
|
||||||
if (!StrEmpty(_network_company_states[ci->client_playas].password) &&
|
* in the middle of the authorization process */
|
||||||
strcmp(password, _network_company_states[ci->client_playas].password) != 0) {
|
CompanyID playas = cs->GetInfo()->client_playas;
|
||||||
|
if (Company::IsValidID(playas) && !StrEmpty(_network_company_states[playas].password) &&
|
||||||
|
strcmp(password, _network_company_states[playas].password) != 0) {
|
||||||
/* Password is invalid */
|
/* Password is invalid */
|
||||||
return SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_WRONG_PASSWORD);
|
return SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_WRONG_PASSWORD);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user