Fix slice out of bounds in federation API

This commit is contained in:
Neil Alexander 2022-11-16 09:39:19 +00:00
parent d558da1c87
commit a2f72dd966
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -125,7 +125,9 @@ func (d *Database) GetJoinedHostsForRooms(ctx context.Context, roomIDs []string,
if excludeSelf { if excludeSelf {
for i, server := range servers { for i, server := range servers {
if d.IsLocalServerName(server) { if d.IsLocalServerName(server) {
servers = append(servers[:i], servers[i+1:]...) copy(servers[:i], servers[i+1:])
servers = servers[:len(servers)-1]
break
} }
} }
} }