* grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Fix handling of
long symlinks.
This commit is contained in:
parent
19ee298767
commit
46bc1dc244
2 changed files with 12 additions and 9 deletions
|
@ -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>
|
2011-10-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Handle symlinks and long names on tar and cpio.
|
Handle symlinks and long names on tar and cpio.
|
||||||
|
@ -11,6 +16,9 @@
|
||||||
L and K entries.
|
L and K entries.
|
||||||
(grub_cpio_mount): Zero-fill data.
|
(grub_cpio_mount): Zero-fill data.
|
||||||
(handle_symlink): New function.
|
(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>
|
2011-10-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -394,21 +394,16 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
|
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)
|
if (++data->linknest > GRUB_UFS_MAX_SYMLNK_CNT)
|
||||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
|
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));
|
grub_strcpy (symlink, (char *) INODE (data, symlink));
|
||||||
else
|
else
|
||||||
{
|
grub_ufs_read_file (data, 0, 0, INODE_SIZE (data), symlink);
|
||||||
grub_disk_read (data->disk,
|
symlink[INODE_SIZE (data)] = '\0';
|
||||||
(INODE_DIRBLOCKS (data, 0)
|
|
||||||
<< grub_le_to_cpu32 (data->sblock.log2_blksz)),
|
|
||||||
0, INODE_SIZE (data), symlink);
|
|
||||||
symlink[INODE_SIZE (data)] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The symlink is an absolute path, go back to the root inode. */
|
/* The symlink is an absolute path, go back to the root inode. */
|
||||||
if (symlink[0] == '/')
|
if (symlink[0] == '/')
|
||||||
|
|
Loading…
Reference in a new issue