about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-16 15:28:33 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-16 15:28:33 -0400
commit2dafe4b390c75df69c966530e8d9d9ba8a0a4601 (patch)
treecc95c0d99394478753724eb418dddcbd57033726
parenta755608ef9d5893b68dc4c774bbda06503481552 (diff)
downloadaerc-2dafe4b390c75df69c966530e8d9d9ba8a0a4601.tar.gz
Fix issues with OOB uids
-rw-r--r--lib/msgstore.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index bd34789..a0da2d8 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -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
 			}
 		}
24' href='#n124'>124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209