Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions iterator_mru_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ int IteratorMruLoadList(const char *name, uint32_t magic, uint32_t item_size,
return 0;
}

count = (int)h.count;
if (count > max_items)
if (h.count > (uint32_t)max_items)
count = max_items;
else
count = (int)h.count;
if (count > 0 && fread(items, item_size, (size_t)count, f) != (size_t)count) {
fclose(f);
return 0;
Expand All @@ -97,7 +98,7 @@ int IteratorMruSaveList(const char *name, uint32_t magic, uint32_t item_size,
IteratorMruHeader h;
FILE *f;

if (count < 0 || item_size == 0)
if (count < 0 || item_size == 0 || (count > 0 && !items))
return 0;

make_state_path(path, sizeof(path), name);
Expand Down