[1916] 2008-11-14 Robert Millan <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 1916
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1916
Author:   robertmh
Date:     2008-11-14 20:08:47 +0000 (Fri, 14 Nov 2008)

Log Message:
-----------
2008-11-14  Robert Millan  <[email protected]>

        * fs/cpio.c (grub_cpio_open): Compare `name' and `fn' by hand in
        order to cope with duplicate slashes.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/cpio.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2008-11-14 19:04:26 UTC (rev 1915)
+++ trunk/grub2/ChangeLog	2008-11-14 20:08:47 UTC (rev 1916)
@@ -1,5 +1,10 @@
 2008-11-14  Robert Millan  <[email protected]>
 
+	* fs/cpio.c (grub_cpio_open): Compare `name' and `fn' by hand in
+	order to cope with duplicate slashes.
+
+2008-11-14  Robert Millan  <[email protected]>
+
 	* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):
 	Redefine to match with GRUB_MEMORY_MACHINE_UPPER_START (0x100000).  We
 	don't want to mess with lower memory, because it is used in the Linux

Modified: trunk/grub2/fs/cpio.c
===================================================================
--- trunk/grub2/fs/cpio.c	2008-11-14 19:04:26 UTC (rev 1915)
+++ trunk/grub2/fs/cpio.c	2008-11-14 20:08:47 UTC (rev 1916)
@@ -262,6 +262,7 @@
   struct grub_cpio_data *data;
   grub_uint32_t ofs;
   char *fn;
+  int i, j;
 
 #ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
@@ -283,16 +284,34 @@
 	  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;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.