:: commit 50b395bf023b9a7647b311cdd855b0df54026394

Mintsuki <mintsuki@protonmail.com> — 2026-02-08 06:19

parents: f1adebea0d

fs/fat32: Check subdirectory attribute during path traversal

diff --git a/common/fs/fat32.s2.c b/common/fs/fat32.s2.c
index 17bf649b..d9db188e 100644
--- a/common/fs/fat32.s2.c
+++ b/common/fs/fat32.s2.c
@@ -669,6 +669,9 @@ struct file_handle *fat32_open(struct volume *part, const char *path) {
         }
 
         if (expect_directory) {
+            if (!(current_file.attribute & FAT32_ATTRIBUTE_SUBDIRECTORY)) {
+                return NULL;
+            }
             _current_directory = current_file;
             current_directory = &_current_directory;
         } else {
tab: 248 wrap: offon