]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/ufs.c (grub_ufs_find_file): Fix handling of double slash.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 10 May 2012 21:33:44 +0000 (23:33 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 10 May 2012 21:33:44 +0000 (23:33 +0200)
* grub-core/fs/minix.c (grub_minix_find_file): Likewise.

ChangeLog
grub-core/fs/minix.c
grub-core/fs/ufs.c

index 0d21557b142d30c8d920e8c2639ff089b4de1dbb..aee8654db58089b361074de731dc8ac293c2b638 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+2012-05-10  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/ufs.c (grub_ufs_find_file): Fix handling of double slash.
+       * grub-core/fs/minix.c (grub_minix_find_file): Likewise.
+
 2012-05-10  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub-menulst2cfg.c (main): Check return value of fwrite.
        * util/grub-mklayout.c (write_file): Likewise. New argument fname.
-       Allusers updated.
+       All users updated.
 
 2012-05-10  Vladimir Serbinenko  <phcoder@gmail.com>
 
index af04f11a4cdb53dfd50a6a5bc80f6e0ca3ed514d..a1b91addbb77a187d21d90b44d6ba98e9b9c2ea8 100644 (file)
@@ -386,12 +386,10 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
   grub_strcpy (fpath, path);
 
   /* Skip the first slash.  */
-  if (name[0] == '/')
-    {
-      name++;
-      if (!*name)
-       return 0;
-    }
+  while (*name == '/')
+    name++;
+  if (!*name)
+    return 0;
 
   /* Extract the actual part from the pathname.  */
   next = grub_strchr (name, '/');
@@ -399,6 +397,8 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
     {
       next[0] = '\0';
       next++;
+      while (*next == '/')
+       next++;
     }
 
   do
@@ -445,6 +445,8 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
            {
              next[0] = '\0';
              next++;
+             while (*next == '/')
+               next++;
            }
 
          if ((GRUB_MINIX_INODE_MODE (data)
index 05a0d2d4213d436c0342d392067c132474766225..bd0cd1f4918f6f1cb2f71373861ec25b5930722f 100644 (file)
@@ -471,12 +471,10 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
   grub_strcpy (fpath, path);
 
   /* Skip the first slash.  */
-  if (name[0] == '/')
-    {
-      name++;
-      if (!*name)
-       return 0;
-    }
+  while (*name == '/')
+    name++;
+  if (!*name)
+    return 0;
 
   /* Extract the actual part from the pathname.  */
   next = grub_strchr (name, '/');
@@ -484,6 +482,8 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
     {
       next[0] = '\0';
       next++;
+      while (*next == '/')
+       next++;
     }
 
   do
@@ -536,6 +536,8 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
              {
                next[0] = '\0';
                next++;
+               while (*next == '/')
+                 next++;
              }
 
            if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)