]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
anvil: Penalty tracking was moving last checksums wrongly with memcpy().
authorTimo Sirainen <tss@iki.fi>
Sat, 9 May 2015 16:50:14 +0000 (19:50 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 9 May 2015 16:50:14 +0000 (19:50 +0300)
Depending on the OS/etc this could have caused the checksum tracking to go
wrong. Found by Coverity.

src/anvil/penalty.c

index dd5bfa1187500050df62c5a97c629e1dd650540d..5034421a8cec31b1f40c626fa83a7b6f357e9ee5 100644 (file)
@@ -105,8 +105,8 @@ penalty_bump_checksum(struct penalty_rec *rec, unsigned int checksum)
        for (i = 0; i < count; i++) {
                if (checksums[i] == checksum) {
                        if (i > 0) {
-                               memcpy(checksums + 1, checksums,
-                                      sizeof(checksums[0]) * i);
+                               memmove(checksums + 1, checksums,
+                                       sizeof(checksums[0]) * i);
                                checksums[0] = checksum;
                        }
                        return TRUE;