From 7ee35fcc28d843b7d6aa88a0e2aebf2419eb2114 Mon Sep 17 00:00:00 2001 From: lda Date: Sat, 18 May 2024 20:26:30 +0200 Subject: [PATCH] [MOD] Clamp depth --- src/Room.c | 3 +++ 1 file changed, 3 insertions(+) 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