From 71e195441ea968c0fd9af48c1d2e5823b7a0db41 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Wed, 21 Nov 2012 22:34:19 +0000 Subject: [PATCH] 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 argument. Signed-off-by: Matt Fleming --- 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 4391114c..d3db75f3 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); } -- 2.11.4.GIT