0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-11-15 22:31:07 +01:00

Fix rare panic when returning user devices over federation (#2534)

This commit is contained in:
Till 2022-06-15 12:50:02 +02:00 committed by GitHub
parent 4c2a10f1a6
commit 1b90cc9536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,6 +85,9 @@ func GetUserDevices(
if targetKey, ok := targetUser[gomatrixserverlib.KeyID(dev.DeviceID)]; ok { if targetKey, ok := targetUser[gomatrixserverlib.KeyID(dev.DeviceID)]; ok {
for sourceUserID, forSourceUser := range targetKey { for sourceUserID, forSourceUser := range targetKey {
for sourceKeyID, sourceKey := range forSourceUser { for sourceKeyID, sourceKey := range forSourceUser {
if device.Keys.Signatures == nil {
device.Keys.Signatures = map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
}
if _, ok := device.Keys.Signatures[sourceUserID]; !ok { if _, ok := device.Keys.Signatures[sourceUserID]; !ok {
device.Keys.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{} device.Keys.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
} }