]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: day_first_uid[] array wasn't kept properly up to date.
authorTimo Sirainen <tss@iki.fi>
Tue, 14 Sep 2010 20:12:08 +0000 (21:12 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 14 Sep 2010 20:12:08 +0000 (21:12 +0100)
The result was that caching decisions could have been sometimes slightly wrong.
Based on patch by Paul E. Black.

src/lib-index/mail-index-transaction-update.c

index 3d4312190f96bc92c1ee86f207726bd3a818dcc2..02afedff6dc67dd1d3c641d48418c75b32f178e4 100644 (file)
@@ -143,7 +143,8 @@ void mail_index_update_day_headers(struct mail_index_transaction *t)
 
        /* @UNSAFE: move days forward and fill the missing days with old
           day_first_uid[0]. */
-       memmove(hdr.day_first_uid + days, hdr.day_first_uid, max_days - days);
+       memmove(hdr.day_first_uid + days, hdr.day_first_uid,
+               (max_days - days) * sizeof(hdr.day_first_uid[0]));
        for (i = 1; i < days; i++)
                hdr.day_first_uid[i] = hdr.day_first_uid[0];