* 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.
This commit is contained in:
Colin Watson 2010-05-27 15:45:41 +01:00
parent 5fdba519bb
commit db2102a046
2 changed files with 9 additions and 1 deletions

View file

@ -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

View 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