[syslinux:elflink] runimage.c: Actually pass arguments to execute ()
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Mon Nov 26 05:27:03 PST 2012
Commit-ID: 71e195441ea968c0fd9af48c1d2e5823b7a0db41
Gitweb: http://www.syslinux.org/commit/71e195441ea968c0fd9af48c1d2e5823b7a0db41
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 21 Nov 2012 22:34:19 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 26 Nov 2012 12:34:13 +0000
runimage.c: Actually pass arguments to execute()
Fix the breakage from commit 8486142cf304 ("elflink: Replace
__intcall() with direct function calls"), where we stopped passing
'cmdline' to execute().
This bug resulted in things like config.c32 not respecting the
<directory> argument.
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/lib/syslinux/runimage.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/com32/lib/syslinux/runimage.c b/com32/lib/syslinux/runimage.c
index 4391114..d3db75f 100644
--- a/com32/lib/syslinux/runimage.c
+++ b/com32/lib/syslinux/runimage.c
@@ -42,26 +42,22 @@ extern unsigned int ipappend;
void syslinux_run_kernel_image(const char *filename, const char *cmdline,
uint32_t ipappend_flags, uint32_t type)
{
- char *bbfilename = NULL;
char *bbcmdline = NULL;
+ size_t len;
+ int rv;
-
- bbfilename = lstrdup(filename);
- if (!bbfilename)
- goto fail;
-
- bbcmdline = lstrdup(cmdline);
+ /* +2 for NULL and space */
+ len = strlen(filename) + strlen(cmdline) + 2;
+ bbcmdline = malloc(len);
if (!bbcmdline)
- goto fail;
+ return;
+
+ rv = snprintf(bbcmdline, len, "%s %s", filename, cmdline);
+ if (rv == -1 || (size_t)rv >= len)
+ return;
if (syslinux_filesystem() == SYSLINUX_FS_PXELINUX)
ipappend = ipappend_flags;
- execute(bbfilename, type);
-
-fail:
- if (bbcmdline)
- lfree(bbcmdline);
- if (bbfilename)
- lfree(bbfilename);
+ execute(bbcmdline, type);
}
More information about the Syslinux-commits
mailing list