aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-08-07 21:55:22 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-08-07 21:55:22 +0100
commit6932ab51971d40966d4d8aa473c15c10899e4763 (patch)
tree3ded34c2df6609d2fe5e8c5d7a8940efb202316a
parentc0f1d73df3fef83cb6a60825c08620de0ded39d5 (diff)
downloadimv-6932ab51971d40966d4d8aa473c15c10899e4763.tar.gz
list: Fix memory corruption bug
-rw-r--r--src/list.c4
1 files changed, 2 insertions, 2 deletions
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;
}