:: commit 33058217fa18d9458507386d592a287694d0e142

mintsuki <mintsuki@protonmail.com> — 2021-02-08 18:06

parents: 5ed2c2203a

fat32: Fix bug with conversion to 8+3 filename

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 202ab6e6..70eb9556 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 616c69d6..7517741c 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 4cc10920..93db3083 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/fs/fat32.c b/stage2/fs/fat32.c
index 287d0d87..b36e000e 100644
--- a/stage2/fs/fat32.c
+++ b/stage2/fs/fat32.c
@@ -167,6 +167,9 @@ static bool fat32_filename_to_8_3(char *dest, const char *src) {
     int i = 0, j = 0;
     bool ext = false;
 
+    for (size_t i = 0; i < 8+3; i++)
+        dest[i] = ' ';
+
     while (src[i]) {
         if (src[i] == '.') {
             if (ext) {
@@ -174,9 +177,7 @@ static bool fat32_filename_to_8_3(char *dest, const char *src) {
                 return false;
             }
             ext = true;
-            // Pad the rest of the base filename with spaces
-            while (j < 8)
-                dest[j++] = ' ';
+            j = 8;
             i++;
             continue;
         }
tab: 248 wrap: offon