]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-11-14 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Fri, 14 Nov 2008 20:08:47 +0000 (20:08 +0000)
committerrobertmh <robertmh@localhost>
Fri, 14 Nov 2008 20:08:47 +0000 (20:08 +0000)
        * fs/cpio.c (grub_cpio_open): Compare `name' and `fn' by hand in
        order to cope with duplicate slashes.

ChangeLog
fs/cpio.c

index 89955178eef9ea2628692f4401e983c5e20fdaa1..834efaca0dbbc53371c870b4e58b460b8478b7d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
index 1692d6108ae111b171aa4282b40d122e2246dad6..4965fe57dc5b328a97c3dd6083a79bbba0bb154b 100644 (file)
--- a/fs/cpio.c
+++ b/fs/cpio.c
@@ -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;
     }