aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-03-25 02:49:28 +0000
committerRob Landley <rob@landley.net>2006-03-25 02:49:28 +0000
commit0bafd47e840bcf887df7d3a634748f3254b01408 (patch)
treea91b1a556912e3fb3b61512436eb7479f40a3363 /modutils
parent771b1864064e211bd2548f2fe06b17af27688377 (diff)
downloadbusybox-0bafd47e840bcf887df7d3a634748f3254b01408.tar.gz
Stephane Billiart found an endianness bug in insmod.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 26dd9783b..efa0499e4 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -516,12 +516,6 @@ int delete_module(const char *);
#include <elf.h>
#include <endian.h>
-#if BB_LITTLE_ENDIAN
-# define ELFDATAM ELFDATA2LSB
-#else
-# define ELFDATAM ELFDATA2MSB
-#endif
-
#ifndef ElfW
# if ELFCLASSM == ELFCLASS32
# define ElfW(x) Elf32_ ## x
@@ -3331,7 +3325,8 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits)
return NULL;
}
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
- || f->header.e_ident[EI_DATA] != ELFDATAM
+ || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN
+ ? ELFDATA2MSB : ELFDATA2LSB)
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|| !MATCH_MACHINE(f->header.e_machine)) {
bb_error_msg("ELF file not for this architecture");