aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Robinson <andr345@gmail.com>2009-05-19 18:18:18 +0200
committerAndreas Robinson <andr345@gmail.com>2009-05-21 12:31:21 +0200
commita5e4ae7aff7630572332f480f0175c2d0c15d1d4 (patch)
treed12792972d0491db6902616719aa7083462a8112
parent8ec96766badb9ea57b7b666fe2a2aff2c7713236 (diff)
downloadmodule-init-tools-a5e4ae7aff7630572332f480f0175c2d0c15d1d4.tar.gz
elfops: fix potential crashing bug in load_symbols()
get_section() returned an undefined section size on failure, which could cause load_symbols() to crash if kernel symtables were missing from the module. get_section() will now return secsize == 0 if it fails. Signed-off-by: Andreas Robinson <andr345@gmail.com>
-rw-r--r--elfops_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/elfops_core.c b/elfops_core.c
index 1e8083b..051e7f7 100644
--- a/elfops_core.c
+++ b/elfops_core.c
@@ -36,6 +36,8 @@ static void *PERBIT(get_section)(struct elf_file *module,
const char *secnames;
unsigned int i;
+ *secsize = 0;
+
if (len <= 0 || len < sizeof(*hdr))
return NULL;
@@ -65,7 +67,6 @@ static void *PERBIT(get_section)(struct elf_file *module,
return data + secoffset;
}
}
- *secsize = 0;
return NULL;
}