Browse Source

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.
1.2
Dmitrij D. Czarkoff 10 years ago committed by Oswald Buddenhagen
parent
commit
0840026a4b
  1. 2
      src/drv_maildir.c

2
src/drv_maildir.c

@ -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)) {

Loading…
Cancel
Save