diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-02 09:15:12 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-14 23:22:04 +0200 |
commit | ebe32ad9129bb5846433366509728fb594f3be62 (patch) | |
tree | 3cd9b58a5da8531796762f33ca53fc6d79de9926 /src/network/network_server.cpp | |
parent | 6db52d52d00516b71a982e61b3b9592a887091aa (diff) | |
download | openttd-ebe32ad9129bb5846433366509728fb594f3be62.tar.xz |
Codechange: [Network] Use std::string for the internal handling of admin/rcon passwords
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r-- | src/network/network_server.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 314407348..7b77c76c4 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1431,15 +1431,14 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *p) { if (this->status != STATUS_ACTIVE) return this->SendError(NETWORK_ERROR_NOT_EXPECTED); - char pass[NETWORK_PASSWORD_LENGTH]; char command[NETWORK_RCONCOMMAND_LENGTH]; if (_settings_client.network.rcon_password.empty()) return NETWORK_RECV_STATUS_OKAY; - p->Recv_string(pass, sizeof(pass)); + std::string password = p->Recv_string(NETWORK_PASSWORD_LENGTH); p->Recv_string(command, sizeof(command)); - if (_settings_client.network.rcon_password.compare(pass) != 0) { + if (_settings_client.network.rcon_password.compare(password) != 0) { DEBUG(net, 1, "[rcon] Wrong password from client-id %d", this->client_id); return NETWORK_RECV_STATUS_OKAY; } |