]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* kern/emu/misc.c (canonicalize_file_name): realpath can still
authorColin Watson <cjwatson@ubuntu.com>
Thu, 27 May 2010 14:45:41 +0000 (15:45 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Thu, 27 May 2010 14:45:41 +0000 (15:45 +0100)
return NULL for various reasons even if it has a maximum-length
buffer: for example, there might be a symlink loop, or the path
might exceed PATH_MAX.  If this happens, return NULL.

ChangeLog
kern/emu/misc.c

index 18c2abeac7525e0167c2e77f34ec52e22de76ac9..34bc31bf9f3135bc463355f098b913754d081fa1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-27  Colin Watson  <cjwatson@ubuntu.com>
+
+       * kern/emu/misc.c (canonicalize_file_name): realpath can still
+       return NULL for various reasons even if it has a maximum-length
+       buffer: for example, there might be a symlink loop, or the path
+       might exceed PATH_MAX.  If this happens, return NULL.
+
 2010-05-27  Robert Millan  <rmh@gnu.org>
 
        * util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Insert
index a3ccb30766e2d8d710f5bafe20b6b7f286f154a4..9437169e002bb05bf5eedc61d22b4007157b638c 100644 (file)
@@ -185,7 +185,8 @@ canonicalize_file_name (const char *path)
   char *ret;
 #ifdef PATH_MAX
   ret = xmalloc (PATH_MAX);
-  (void) realpath (path, ret);
+  if (!realpath (path, ret))
+    return NULL;
 #else
   ret = realpath (path, NULL);
 #endif