* grub-core/fs/cpio.c (canonicalize): Handle "..".

(grub_cpio_find_file) [MODE_USTAR]: Handle hardlinks.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-27 00:54:41 +02:00
parent f3250e5f1f
commit fc977f485f
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2012-05-27 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/cpio.c (canonicalize): Handle "..".
(grub_cpio_find_file) [MODE_USTAR]: Handle hardlinks.
2012-05-27 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/btrfs.c (GRUB_BTRFS_ITEM_TYPE_INODE_REF): New enum value.

View file

@ -142,6 +142,15 @@ canonicalize (char *name)
iptr += 2;
continue;
}
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
{
iptr += 3;
if (optr == name)
continue;
for (optr -= 2; optr >= name && *optr != '/'; optr--);
optr++;
continue;
}
while (*iptr && *iptr != '/')
*optr++ = *iptr++;
if (*iptr)
@ -341,6 +350,9 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
*mode = read_number (hd.mode, sizeof (hd.mode));
switch (hd.typeflag)
{
/* Hardlink. */
case '1':
/* Symlink. */
case '2':
*mode |= ATTR_LNK;
break;