Fix issues with OOB uids

This commit is contained in:
Drew DeVault 2019-05-16 15:28:33 -04:00
parent a755608ef9
commit 2dafe4b390
1 changed files with 3 additions and 3 deletions

View File

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