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> 2008-11-14 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE): * 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; struct grub_cpio_data *data;
grub_uint32_t ofs; grub_uint32_t ofs;
char *fn; char *fn;
int i, j;
#ifndef GRUB_UTIL #ifndef GRUB_UTIL
grub_dl_ref (my_mod); grub_dl_ref (my_mod);
@ -283,14 +284,32 @@ grub_cpio_open (grub_file_t file, const char *name)
break; 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)
{ {
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->data = data;
file->size = data->size; file->size = data->size;
grub_free (fn); grub_free (fn);
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
}
no_match:
grub_free (fn); grub_free (fn);
data->hofs = ofs; data->hofs = ofs;