]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge trunk
authorColin Watson <cjwatson@ubuntu.com>
Fri, 7 Jan 2011 17:26:15 +0000 (17:26 +0000)
committerColin Watson <cjwatson@ubuntu.com>
Fri, 7 Jan 2011 17:26:15 +0000 (17:26 +0000)
1  2 
grub-core/kern/emu/getroot.c

index a4cfaffc93a89a1833ec66f8d951c269ce0df508,aedef9e0e02756bc9b7cefc3601ddf1537bd3212..df3a4d7650e71c2416f5d9bb05d20a3a87da14bc
@@@ -134,9 -131,16 +134,13 @@@ grub_find_root_device_from_mountinfo (c
                  &count) < 6)
        continue;
  
 -      if (strcmp (enc_root, "/") != 0)
 -      continue; /* only a subtree is mounted */
 -
        enc_path_len = strlen (enc_path);
+       /* Check that enc_path is a prefix of dir.  The prefix must either be
+          the entire string, or end with a slash, or be immediately followed
+          by a slash.  */
        if (strncmp (dir, enc_path, enc_path_len) != 0 ||
-         (dir[enc_path_len] && dir[enc_path_len] != '/'))
+         (enc_path_len && dir[enc_path_len - 1] != '/' &&
+          dir[enc_path_len] && dir[enc_path_len] != '/'))
        continue;
  
        /* This is a parent of the requested directory.  /proc/self/mountinfo