[syslinux:master] core: always canonicalize the configuration file name

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Fri Jul 2 16:18:15 PDT 2010


Commit-ID:  f88518c9b3538b229bc4e877fcc64a5e1515da8b
Gitweb:     http://syslinux.zytor.com/commit/f88518c9b3538b229bc4e877fcc64a5e1515da8b
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Fri, 2 Jul 2010 16:01:19 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Fri, 2 Jul 2010 16:01:19 -0700

core: always canonicalize the configuration file name

The FAT installers may not produce a canonical pathname in the
CurrentDirName field on entry.  Make sure that the core doesn't croak
when that happens, and still produces an absolute pathname for the
configuration file.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 core/fs/lib/loadconfig.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/core/fs/lib/loadconfig.c b/core/fs/lib/loadconfig.c
index 356d5a2..db538b8 100644
--- a/core/fs/lib/loadconfig.c
+++ b/core/fs/lib/loadconfig.c
@@ -13,6 +13,7 @@
  */
 int generic_load_config(void)
 {
+    char confignamebuf[FILENAME_MAX];
     static const char *search_directories[] = {
 	NULL,			/* CurrentDirName */
 	"/boot/syslinux", 
@@ -36,9 +37,11 @@ int generic_load_config(void)
 	const char *sd = search_directories[i];
 	for (j = 0; filenames[j]; j++) {
 	    memset(&regs, 0, sizeof regs);
-	    snprintf(ConfigName, FILENAME_MAX, "%s%s%s",
+	    snprintf(confignamebuf, sizeof confignamebuf,
+		     "%s%s%s",
 		     sd, (*sd && sd[strlen(sd)-1] == '/') ? "" : "/",
 		     filenames[j]);
+	    realpath(ConfigName, confignamebuf, FILENAME_MAX);
 	    regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
 	    dprintf("Config search: %s\n", ConfigName);
 	    call16(core_open, &regs, &regs);



More information about the Syslinux-commits mailing list