From 6932ab51971d40966d4d8aa473c15c10899e4763 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Wed, 7 Aug 2019 21:55:22 +0100 Subject: list: Fix memory corruption bug --- src/list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/list.c') diff --git a/src/list.c b/src/list.c index a1261d0..b719cf0 100644 --- a/src/list.c +++ b/src/list.c @@ -48,7 +48,7 @@ void list_remove(struct list *list, size_t index) return; } - memmove(&list->items[index], &list->items[index + 1], list->len - index); + memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->len - index)); list->len -= 1; } @@ -61,7 +61,7 @@ void list_insert(struct list *list, size_t index, void *item) index = list->len; } - memmove(&list->items[index + 1], &list->items[index], list->len - index); + memmove(&list->items[index + 1], &list->items[index], sizeof(void*) * (list->len - index)); list->items[index] = item; list->len += 1; } -- cgit v1.2.3