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:
parent
95276cd967
commit
0840026a4b
|
@ -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…
Reference in New Issue
Block a user