2008-11-14 Robert Millan <rmh@aybabtu.com>

* fs/cpio.c (grub_cpio_open): Compare `name' and `fn' by hand in
        order to cope with duplicate slashes.
This commit is contained in:
robertmh 2008-11-14 20:08:47 +00:00
parent 10fc3eb9a7
commit dfab719fc8
2 changed files with 30 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-11-14 Robert Millan <rmh@aybabtu.com>
* fs/cpio.c (grub_cpio_open): Compare `name' and `fn' by hand in
order to cope with duplicate slashes.
2008-11-14 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):

View File

@ -262,6 +262,7 @@ grub_cpio_open (grub_file_t file, const char *name)
struct grub_cpio_data *data;
grub_uint32_t ofs;
char *fn;
int i, j;
#ifndef GRUB_UTIL
grub_dl_ref (my_mod);
@ -283,15 +284,33 @@ grub_cpio_open (grub_file_t file, const char *name)
break;
}
if (grub_strcmp (name + 1, fn) == 0)
/* Compare NAME and FN by hand in order to cope with duplicate
slashes. */
i = 1;
j = 0;
while (1)
{
file->data = data;
file->size = data->size;
grub_free (fn);
return GRUB_ERR_NONE;
if (name[i] != fn[j])
goto no_match;
if (name[i] == '\0')
break;
if (name[i] == '/' && name[i+1] == '/')
i++;
i++;
j++;
}
file->data = data;
file->size = data->size;
grub_free (fn);
return GRUB_ERR_NONE;
no_match:
grub_free (fn);
data->hofs = ofs;
}