From: Timo Sirainen Date: Sat, 9 May 2015 16:50:14 +0000 (+0300) Subject: anvil: Penalty tracking was moving last checksums wrongly with memcpy(). X-Git-Tag: 2.2.17.rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f29b324658de9e42e75af45e2a198f3ba300031;p=thirdparty%2Fdovecot%2Fcore.git anvil: Penalty tracking was moving last checksums wrongly with memcpy(). Depending on the OS/etc this could have caused the checksum tracking to go wrong. Found by Coverity. --- diff --git a/src/anvil/penalty.c b/src/anvil/penalty.c index dd5bfa1187..5034421a8c 100644 --- a/src/anvil/penalty.c +++ b/src/anvil/penalty.c @@ -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;