:: commit 3fe4cb829867a845f192172632007e9ff08980cb

mintsuki <mintsuki@protonmail.com> — 2020-11-13 23:59

parents: c15e8527d4

ext2: Fix bug where tokens were not appended a 0 terminator when examining path

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 36ecda00..80a42571 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index e14beb42..3e9b83e4 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2/fs/ext2.c b/stage2/fs/ext2.c
index e1d20a77..396002a1 100644
--- a/stage2/fs/ext2.c
+++ b/stage2/fs/ext2.c
@@ -214,13 +214,15 @@ static int ext2_parse_dirent(struct ext2_dir_entry *dir, struct ext2_file_handle
     struct ext2_inode current_inode = fd->root_inode;

 

     bool escape = false;

-

     char token[256] = {0};

+    size_t i;

 

 next:

-    for (size_t i = 0; *path != '/' && *path != '\0'; i++, path++)

+    for (i = 0; i < 255 && *path != '/' && *path != '\0'; i++, path++)

         token[i] = *path;

 

+    token[i] = 0;

+

     if (*path == '\0')

         escape = true;

     else

tab: 248 wrap: offon