:: commit 898407760f924bc7692c66292a9ad837dfa02953

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

parents: c373a734c5

fat32: Fix bug with conversion to 8+3 filename

diff --git a/limine-pxe.bin b/limine-pxe.bin
index bebddebf..a0664bdd 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 3d038009..94f837c2 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 1f7b8a17..5a8a0beb 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/fs/fat32.c b/stage2/fs/fat32.c
index 852365b2..cc43f8f4 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