]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
xfs: fix possible inode corruption in directory scan
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 15:55:55 +0000 (18:55 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 15:55:55 +0000 (18:55 +0300)
grub_xfs_iterate_dir did not restore first character after inline
name when match was found. Dependning on XFS format this character
could be inode number and we could return to the same node later in
find_file if processing cycled symlinks.

CID: 86724

grub-core/fs/xfs.c

index a03526b321afb196369798ccdde01155e4faa387..ca9c0c37aae71a7934aaab65b17f4a53725059bc 100644 (file)
@@ -775,7 +775,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
            c = de->name[de->len];
            de->name[de->len] = '\0';
            if (iterate_dir_call_hook (ino, de->name, &ctx))
-             return 1;
+             {
+               de->name[de->len] = c;
+               return 1;
+             }
            de->name[de->len] = c;
 
            de = grub_xfs_inline_next_de(dir->data, head, de);