diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-29 08:47:15 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-29 08:47:15 +0000 |
commit | 556e76db9ba0d8f23770b839c9f42121b61d4348 (patch) | |
tree | e0dbf840ecc3cce7fd62371e6cd1949a837833f6 | |
parent | affd61825f0502af0697d393aeb76ddf0a7a4fac (diff) | |
download | syslinux-556e76db9ba0d8f23770b839c9f42121b61d4348.tar.gz syslinux-556e76db9ba0d8f23770b839c9f42121b61d4348.tar.xz syslinux-556e76db9ba0d8f23770b839c9f42121b61d4348.zip |
ldlinux: Only append missing filename extensions
Don't append an extension like ".c32" if the command already has one!
This bug lead to "config.c32" being executed as "config.c32.c32" with
the below config snippet,
LABEL config
COM32 config.c32 /configs/isolinux.cfg
Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | com32/elflink/ldlinux/ldlinux.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index 82d2ae6d..62db2f71 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -121,12 +121,15 @@ const char *apply_extension(const char *kernel, const char *ext) memcpy(k, kernel, len); /* Append the extension */ - memcpy(k + len, ext, elen); + if (strncmp(p - elen, ext, elen)) { + memcpy(k + len, ext, elen); + len += elen; + } /* Copy the rest of the command line */ - strcpy(k + len + elen, p); + strcpy(k + len, p); - k[len + elen + strlen(p)] = '\0'; + k[len + strlen(p)] = '\0'; return k; } |