fix crash in maildir_set_msg_flags()

memcpy(3)'s behavior is undefined when source and destination addresses
overlap, and it actually crashed on OpenBSD. use memmove() instead.
This commit is contained in:
Dmitrij D. Czarkoff 2015-04-03 22:38:46 +02:00 committed by Oswald Buddenhagen
parent 95276cd967
commit 0840026a4b

View File

@ -1464,7 +1464,7 @@ maildir_set_msg_flags( store_t *gctx, message_t *gmsg, int uid ATTR_UNUSED, int
for (i = 0; i < as(Flags); i++) {
if ((p = strchr( s, Flags[i] ))) {
if (del & (1 << i)) {
memcpy( p, p + 1, fl - (p - s) );
memmove( p, p + 1, fl - (p - s) );
fl--;
}
} else if (add & (1 << i)) {