1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix potential crash on corrupted network data

This commit is contained in:
ZehMatt
2021-08-06 18:16:24 +03:00
parent 40a4a993de
commit 87fbb9faf5
3 changed files with 23 additions and 10 deletions

View File

@@ -2488,6 +2488,12 @@ void NetworkBase::Server_Handle_MAPREQUEST(NetworkConnection& connection, Networ
for (uint32_t i = 0; i < size; i++)
{
const char* name = reinterpret_cast<const char*>(packet.Read(8));
if (name == nullptr)
{
log_error("Client sent malformed object request data %s", connection.Socket->GetHostName());
return;
}
// This is required, as packet does not have null terminator
std::string s(name, name + 8);
log_verbose("Client requested object %s", s.c_str());