* grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Use proper check for

inline symlinks in addition to workaround.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-03 09:21:09 +02:00
parent 3b4afb4de1
commit 59fd2aacd0
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Use proper check for
inline symlinks in addition to workaround.
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Handle read_inode errors.

View File

@ -401,7 +401,13 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
if (++data->linknest > GRUB_UFS_MAX_SYMLNK_CNT)
return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
if (INODE_SIZE (data) <= sizeof (data->inode.symlink))
/* Normally we should just check that data->inode.nblocks == 0.
However old Linux doesn't maintain nblocks correctly and so it's always
0. If size is bigger than inline space then the symlink is surely not
inline. */
/* Check against zero is paylindromic, no need to swap. */
if (data->inode.nblocks == 0
&& INODE_SIZE (data) <= sizeof (data->inode.symlink))
grub_strcpy (symlink, (char *) INODE (data, symlink));
else
grub_ufs_read_file (data, 0, 0, INODE_SIZE (data), symlink);