arraylist_add: don't overflow when strcpy to the icon

This commit is contained in:
korei999 2025-01-17 19:05:25 +02:00
parent c68c0169d4
commit 098403eba6

2
file.c
View file

@ -69,7 +69,7 @@ void arraylist_remove(ArrayList *list, long index)
void arraylist_add(ArrayList *list, char *name, char *path, char *stats, int type, char *icon, int color, int marked, int force)
{
file new_file = { name, path, type, stats, color };
strcpy(new_file.icon, icon);
strncpy(new_file.icon, icon, sizeof(new_file.icon) / sizeof(new_file.icon[0]));
if (list->capacity != list->length) {
if (marked) {