From a2f72dd966fb53b265ed0df0d792027af704a08b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 16 Nov 2022 09:39:19 +0000 Subject: [PATCH] Fix slice out of bounds in federation API --- federationapi/storage/shared/storage.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/federationapi/storage/shared/storage.go b/federationapi/storage/shared/storage.go index 7d6e8a68..f86ae2e0 100644 --- a/federationapi/storage/shared/storage.go +++ b/federationapi/storage/shared/storage.go @@ -125,7 +125,9 @@ func (d *Database) GetJoinedHostsForRooms(ctx context.Context, roomIDs []string, if excludeSelf { for i, server := range servers { if d.IsLocalServerName(server) { - servers = append(servers[:i], servers[i+1:]...) + copy(servers[:i], servers[i+1:]) + servers = servers[:len(servers)-1] + break } } }