1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 13:33:02 +01:00

Fix #20964: Crash when invalid network group id is used

This commit is contained in:
ζeh Matt
2023-11-11 18:59:46 +02:00
parent b12d659db3
commit 37cdc40799

View File

@@ -2643,7 +2643,10 @@ void NetworkBase::ServerHandleAuth(NetworkConnection& connection, NetworkPacket&
if (connection.AuthStatus == NetworkAuth::Verified)
{
const NetworkGroup* group = GetGroupByID(GetGroupIDByHash(connection.Key.PublicKeyHash()));
passwordless = group->CanPerformAction(NetworkPermission::PasswordlessLogin);
if (group != nullptr)
{
passwordless = group->CanPerformAction(NetworkPermission::PasswordlessLogin);
}
}
if (gameversion != NetworkGetVersion())
{
@@ -3649,6 +3652,11 @@ GameActions::Result NetworkModifyGroups(
case ModifyGroupType::SetName:
{
NetworkGroup* group = network.GetGroupByID(groupId);
if (group == nullptr)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_GROUP, STR_NONE);
}
const char* oldName = group->GetName().c_str();
if (strcmp(oldName, name.c_str()) == 0)