dovecot-2.2: lib-index: Avoid memcpy()ing data over itself.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jun 1 17:12:06 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/74875424373d
changeset: 16447:74875424373d
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jun 01 17:11:55 2013 +0300
description:
lib-index: Avoid memcpy()ing data over itself.

diffstat:

 src/lib-index/mail-index-transaction-finish.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r 09a57e2f07df -r 74875424373d src/lib-index/mail-index-transaction-finish.c
--- a/src/lib-index/mail-index-transaction-finish.c	Sat Jun 01 17:08:19 2013 +0300
+++ b/src/lib-index/mail-index-transaction-finish.c	Sat Jun 01 17:11:55 2013 +0300
@@ -293,8 +293,10 @@
 		expunges[dest].uid =
 			mail_index_transaction_get_uid(t, expunges[src].uid);
 		if (expunges[dest-1].uid != expunges[dest].uid) {
-			memcpy(expunges[dest].guid_128, expunges[src].guid_128,
-			       sizeof(expunges[dest].guid_128));
+			if (dest != src) {
+				memcpy(expunges[dest].guid_128, expunges[src].guid_128,
+				       sizeof(expunges[dest].guid_128));
+			}
 			dest++;
 		}
 	}


More information about the dovecot-cvs mailing list