aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Bucur <stefanb@zytor.com>2008-08-15 17:05:35 +0300
committerStefan Bucur <stefan@stefan-ubumac.(none)>2009-03-15 10:12:27 +0200
commit1f15cadad8948fe229abcc5e15850e08c4973a89 (patch)
tree4766ff6f0d93131c5ae539184f31b525af729caf
parentf046937fc4392e0f5b69be1312a597188c394fb6 (diff)
downloadsyslinux-elf-1f15cadad8948fe229abcc5e15850e08c4973a89.tar.gz
syslinux-elf-1f15cadad8948fe229abcc5e15850e08c4973a89.tar.xz
syslinux-elf-1f15cadad8948fe229abcc5e15850e08c4973a89.zip
Fixed a bug that permitted loading as libs of exec modules.
-rw-r--r--com32/elflink/exec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/com32/elflink/exec.c b/com32/elflink/exec.c
index 33d5ff7a..a987c98c 100644
--- a/com32/elflink/exec.c
+++ b/com32/elflink/exec.c
@@ -67,6 +67,12 @@ int load_library(const char *name) {
return res;
}
+ if (*(module->main_func) != NULL) {
+ DBG_PRINT("Cannot load executable module as library.\n");
+ module_unload(module);
+ return -1;
+ }
+
if (*(module->init_func) != NULL) {
res = (*(module->init_func))();
DBG_PRINT("Initialization function returned: %d\n", res);