From 2dc83c49edc6612195376551e64a1296670d4afb Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Tue, 21 May 2024 18:06:57 +0200 Subject: [PATCH] Add additional check in fatfs_get_file_sectors --- src/flashcart/flashcart_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flashcart/flashcart_utils.c b/src/flashcart/flashcart_utils.c index 3eb13605..cfc714da 100644 --- a/src/flashcart/flashcart_utils.c +++ b/src/flashcart/flashcart_utils.c @@ -51,7 +51,7 @@ bool fatfs_get_file_sectors (char *path, uint32_t *address, address_type_t type, uint32_t cluster = fil.clust; - if (cluster >= fs->n_fatent) { + if ((cluster < 2) || (cluster >= fs->n_fatent)) { error = true; break; }