From b2bc07e51dbd2fd0f8455c73759ef5db8c2af746 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Sun, 3 Jan 2016 21:20:24 +0100 Subject: [PATCH] Fix a crash due to overlapping arguments of memcpy(3). As the use of memcpy(3) on overlapping memory regions is strictly undefined, OpenBSD's memcpy(3) triggers an abort in such cases. --- source/rofi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/rofi.c b/source/rofi.c index 0c6f388c..b830114a 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -940,7 +940,7 @@ static void menu_refilter ( MenuState *state ) g_mutex_clear ( &mutex ); for ( unsigned int i = 0; i < nt; i++ ) { if ( j != states[i].start ) { - memcpy ( &( state->line_map[j] ), &( state->line_map[states[i].start] ), sizeof ( unsigned int ) * ( states[i].count ) ); + memmove ( &( state->line_map[j] ), &( state->line_map[states[i].start] ), sizeof ( unsigned int ) * ( states[i].count ) ); } j += states[i].count; }