]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Fix handling of
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 31 Oct 2011 09:40:30 +0000 (10:40 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 31 Oct 2011 09:40:30 +0000 (10:40 +0100)
long symlinks.

ChangeLog
grub-core/fs/ufs.c

index 543823e9cb48af98410ea3aa3c31ca29a7fe90d5..825524c09b6108b75618e55f0793501df185a6e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-31  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Fix handling of
+       long symlinks.
+
 2011-10-30  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Handle symlinks and long names on tar and cpio.
@@ -11,6 +16,9 @@
        L and K entries.
        (grub_cpio_mount): Zero-fill data.
        (handle_symlink): New function.
+       (grub_cpio_dir): Handle symlinks.
+       (grub_cpio_open): Likewise.
+       (grub_cpio_close) [MODE_USTAR]: Free linkname.
 
 2011-10-30  Vladimir Serbinenko  <phcoder@gmail.com>
 
index 435fec6a5e80eb94aedea50dfc9e6c7f570853a7..ea7a7455fee5f6ccfd52563d809d9db0f94a785d 100644 (file)
@@ -394,21 +394,16 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
 static grub_err_t
 grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
 {
-  char symlink[INODE_SIZE (data)];
+  char symlink[INODE_SIZE (data) + 1];
 
   if (++data->linknest > GRUB_UFS_MAX_SYMLNK_CNT)
     return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
 
-  if (INODE_NBLOCKS (data) == 0)
+  if (INODE_SIZE (data) <= sizeof (data->inode.symlink))
     grub_strcpy (symlink, (char *) INODE (data, symlink));
   else
-    {
-      grub_disk_read (data->disk,
-                     (INODE_DIRBLOCKS (data, 0)
-                      << grub_le_to_cpu32 (data->sblock.log2_blksz)),
-                     0, INODE_SIZE (data), symlink);
-      symlink[INODE_SIZE (data)] = '\0';
-    }
+    grub_ufs_read_file (data, 0, 0, INODE_SIZE (data), symlink);
+  symlink[INODE_SIZE (data)] = '\0';
 
   /* The symlink is an absolute path, go back to the root inode.  */
   if (symlink[0] == '/')