fix(script_event_handler): fix crash (#3105)

This commit is contained in:
Mr-X-GTA 2024-05-13 00:45:57 +02:00 committed by GitHub
parent cb78d9a868
commit db371a3911

View File

@ -453,18 +453,24 @@ namespace big
case eNetworkEvents::SCRIPTED_GAME_EVENT: case eNetworkEvents::SCRIPTED_GAME_EVENT:
{ {
const auto scripted_game_event = std::make_unique<CScriptedGameEvent>(); const auto scripted_game_event = std::make_unique<CScriptedGameEvent>();
buffer->ReadDword(&scripted_game_event->m_args_size, 32); buffer->ReadDword(&scripted_game_event->m_args_size, 32);
if (scripted_game_event->m_args_size - 1 <= 0x1AF) if (scripted_game_event->m_args_size > sizeof(scripted_game_event->m_args))
buffer->ReadArray(&scripted_game_event->m_args, 8 * scripted_game_event->m_args_size); {
notify::crash_blocked(source_player, "out of bounds tse args size");
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;
}
buffer->ReadArray(&scripted_game_event->m_args, 8 * scripted_game_event->m_args_size);
if (hooks::scripted_game_event(scripted_game_event.get(), source_player)) if (hooks::scripted_game_event(scripted_game_event.get(), source_player))
{ {
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return; return;
} }
buffer->Seek(0);
buffer->Seek(0);
break; break;
} }
case eNetworkEvents::NETWORK_CLEAR_PED_TASKS_EVENT: case eNetworkEvents::NETWORK_CLEAR_PED_TASKS_EVENT: