Fix issues with OOB uids

This commit is contained in:
Drew DeVault 2019-05-16 15:28:33 -04:00
parent a755608ef9
commit 2dafe4b390

View file

@ -191,9 +191,9 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
} }
uids := make([]uint32, len(store.Uids)-len(msg.Uids)) uids := make([]uint32, len(store.Uids)-len(msg.Uids))
j := 0 j := 0
for i, uid := range store.Uids { for _, uid := range store.Uids {
if _, deleted := toDelete[uid]; !deleted { if _, deleted := toDelete[uid]; !deleted && j < len(uids) {
uids[j] = store.Uids[i] uids[j] = uid
j += 1 j += 1
} }
} }