mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-10-12 02:09:17 +00:00
Validate RPCN room message fields
RPCN room peers control message payloads and destination lists. Values above the Matching2 limits overflow the recipient's fixed event buffer and terminate the NP handler. Reject malformed room message notifications before allocating event data.
This commit is contained in:
@@ -229,6 +229,30 @@ namespace np
|
||||
return;
|
||||
}
|
||||
|
||||
const u32 cast_type = message_info->casttype().value();
|
||||
const int dst_size = message_info->dst_size();
|
||||
bool valid_destination = false;
|
||||
|
||||
switch (cast_type)
|
||||
{
|
||||
case SCE_NP_MATCHING2_CASTTYPE_BROADCAST:
|
||||
valid_destination = dst_size == 0;
|
||||
break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_UNICAST:
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST_TEAM:
|
||||
valid_destination = dst_size == 1;
|
||||
break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST:
|
||||
valid_destination = dst_size > 0 && dst_size <= SCE_NP_MATCHING2_ROOM_MAX_SLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!valid_destination || message_info->msg().size() > SCE_NP_MATCHING2_BIN_MSG_MAX_SIZE)
|
||||
{
|
||||
rpcn_log.error("Received malformed RoomMessageReceived notification");
|
||||
return;
|
||||
}
|
||||
|
||||
const u32 event_key = get_event_key();
|
||||
auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user