diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:18:49 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:18:49 -0800 |
commit | 8a4b35805fdc6651d288a3e1c2d98aa504cb9c05 (patch) | |
tree | 37c4bdef99996ab681e03c7a3f407563a9ff35d7 /com32/lib/syslinux/runimage.c | |
parent | 3ae1da98a68d2f719ce17766550f7e9682ba8ae7 (diff) | |
download | syslinux-8a4b35805fdc6651d288a3e1c2d98aa504cb9c05.tar.gz |
com32: replace hard-coded bounce buffer use in com32/libsyslinux-4.00-pre25
Replace hard-coded bounce buffer uses in com32/lib with lmalloc/lfree.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/lib/syslinux/runimage.c')
-rw-r--r-- | com32/lib/syslinux/runimage.c | 26 |
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); } |