mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Enforce limits when joining rooms
This commit is contained in:
@@ -44,6 +44,7 @@ use service::{
|
|||||||
rooms::{
|
rooms::{
|
||||||
state::RoomMutexGuard,
|
state::RoomMutexGuard,
|
||||||
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
||||||
|
timeline::pdu_fits,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -573,6 +574,13 @@ async fn join_room_by_id_helper_remote(
|
|||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if !pdu_fits(&mut value.clone()) {
|
||||||
|
warn!(
|
||||||
|
"dropping incoming PDU {event_id} in room {room_id} from room join because \
|
||||||
|
it exceeds 65535 bytes or is otherwise too large."
|
||||||
|
);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
services.rooms.outlier.add_pdu_outlier(&event_id, &value);
|
services.rooms.outlier.add_pdu_outlier(&event_id, &value);
|
||||||
if let Some(state_key) = &pdu.state_key {
|
if let Some(state_key) = &pdu.state_key {
|
||||||
let shortstatekey = services
|
let shortstatekey = services
|
||||||
|
|||||||
Reference in New Issue
Block a user