aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-01-24 11:52:32 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-01-24 17:22:45 +0000
commitb1d6dbbb4cf1784ebb8dff0d772b6bc2cb5c89e3 (patch)
treeb7f3316954758fabfd2f861e16ee83408319c4be /com32/elflink
parent6911cf7e57a870f887042ccb4c580165d868d25c (diff)
downloadsyslinux-b1d6dbbb4cf1784ebb8dff0d772b6bc2cb5c89e3.tar.gz
syslinux-b1d6dbbb4cf1784ebb8dff0d772b6bc2cb5c89e3.tar.xz
syslinux-b1d6dbbb4cf1784ebb8dff0d772b6bc2cb5c89e3.zip
ldlinux: Dynamically allocate cmdline buffer to avoid overflow
Also, because we no longer pass the allocated buffer to __intcall() and friends we can use malloc() instead of lmalloc(), leaving precious low memory for other users. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink')
-rw-r--r--com32/elflink/ldlinux/execute.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index 727df50a..5c53b995 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -55,11 +55,9 @@ __export void execute(const char *cmdline, uint32_t type)
memset(&ireg, 0, sizeof ireg);
- /* for parameter will be passed to __intcall, we need use
- * lmalloc a block of low memory */
- q = lmalloc(128);
+ q = malloc(strlen(cmdline) + 2);
if (!q) {
- printf("%s(): Fail to lmalloc a buffer to exec %s\n",
+ printf("%s(): Fail to malloc a buffer to exec %s\n",
__func__, cmdline);
return;
}
@@ -147,7 +145,7 @@ __export void execute(const char *cmdline, uint32_t type)
new_linux_kernel((char *)kernel, (char *)cmdline);
}
- lfree((void *)kernel);
+ free((void *)kernel);
/* If this returns, something went bad; return to menu */
}