From 69b2069dea160faff6b2b13bb3d660037f12649d Mon Sep 17 00:00:00 2001 From: Till <2353100+S7evinK@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:45:44 +0200 Subject: [PATCH] Avoid loops by setting end to an empty string if start == end (#3146) --- syncapi/routing/messages.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syncapi/routing/messages.go b/syncapi/routing/messages.go index 937e20ad8d..c38716185e 100644 --- a/syncapi/routing/messages.go +++ b/syncapi/routing/messages.go @@ -250,6 +250,12 @@ func OnIncomingMessagesRequest( } } + // If start and end are equal, we either reached the beginning or something else + // is wrong. To avoid endless loops from clients, set end to 0 an empty string + if start == end { + end = types.TopologyToken{} + } + util.GetLogger(req.Context()).WithFields(logrus.Fields{ "from": from.String(), "to": to.String(),