summaryrefslogtreecommitdiff
path: root/com32/lib/syslinux/runimage.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/syslinux/runimage.c')
-rw-r--r--com32/lib/syslinux/runimage.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/com32/lib/syslinux/runimage.c b/com32/lib/syslinux/runimage.c
index 0184df37..29e9aadd 100644
--- a/com32/lib/syslinux/runimage.c
+++ b/com32/lib/syslinux/runimage.c
@@ -40,26 +40,32 @@ void syslinux_run_kernel_image(const char *filename, const char *cmdline,
uint32_t ipappend_flags, uint32_t type)
{
static com32sys_t ireg;
- char *bbfilename, *bbcmdline, *bbptr;
+ char *bbfilename = NULL;
+ char *bbcmdline = NULL;
int bytes;
- bbptr = __com32.cs_bounce;
+ bbfilename = lstrdup(filename);
+ if (!bbfilename)
+ goto fail;
- bytes = strlen(filename) + 1;
- memcpy(bbfilename = bbptr, filename, bytes);
- bbptr += bytes;
+ bbcmdline = lstrdup(cmdline);
+ if (!bbcmdline)
+ goto fail;
- bytes = strlen(cmdline) + 1;
- memcpy(bbcmdline = bbptr, filename, bytes);
- bbptr += bytes;
ireg.eax.w[0] = 0x0016;
ireg.ds = SEG(bbfilename);
- ireg.esi.w[0] = OFFS(bbfilename);
+ /* ireg.esi.w[0] = OFFS(bbfilename); */
ireg.es = SEG(bbcmdline);
- ireg.ebx.w[0] = OFFS(bbcmdline);
+ /* ireg.ebx.w[0] = OFFS(bbcmdline); */
ireg.ecx.l = ipappend_flags;
ireg.edx.l = type;
__intcall(0x22, &ireg, 0);
+
+fail:
+ if (bbcmdline)
+ lfree(bbcmdline);
+ if (bbfilename)
+ lfree(bbfilename);
}