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
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 9 additions and 1 deletions

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)