diff --git a/src/Room.c b/src/Room.c index 652c083..c17499a 100644 --- a/src/Room.c +++ b/src/Room.c @@ -499,6 +499,9 @@ PopulateEventV1(Room * room, HashMap * event, PduV1 * pdu, ServerPart serv) pdu->room_id = StrDuplicate(room->id); pdu->signatures = HashMapCreate(); pdu->depth = RoomGetDepth(room) + 1; /* TODO: Clamp this value. */ + pdu->depth = + pdu->depth >= (int64_t) UINT64_MAX ? + (int64_t) UINT64_MAX : pdu->depth; /* Create a random event ID for this PDU. * TODO: Optionally verify whenever it's already used, but that