summaryrefslogtreecommitdiff
path: root/src/format/elf/section.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-06-01 17:49:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-06-01 17:49:32 (GMT)
commitf6252e57c770fea10439659f35a69a783ff849d3 (patch)
treeefc64ca7703648e439483ee6f4c14db855d7f952 /src/format/elf/section.c
parent1b8152d6f95b03f81aa6a4043c23a45a9f74c418 (diff)
Provided found MIPS routines.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@69 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/elf/section.c')
-rw-r--r--src/format/elf/section.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/format/elf/section.c b/src/format/elf/section.c
index 7ad8363..c619293 100644
--- a/src/format/elf/section.c
+++ b/src/format/elf/section.c
@@ -50,11 +50,12 @@ bool read_elf_section_names(elf_format *format)
Elf32_Shdr section; /* Section visée */
offset = format->header.e_shoff + format->header.e_shentsize * format->header.e_shstrndx;
- if ((offset + sizeof(Elf32_Shdr)) >= EXE_FORMAT(format)->length) return false;
+
+ if ((offset + sizeof(Elf32_Shdr)) > EXE_FORMAT(format)->length) return false;
memcpy(&section, &EXE_FORMAT(format)->content[offset], sizeof(Elf32_Shdr));
- if ((section.sh_offset + section.sh_size) >= EXE_FORMAT(format)->length) return false;
+ if ((section.sh_offset + section.sh_size) > EXE_FORMAT(format)->length) return false;
format->sec_names = (char *)calloc(section.sh_size + 1, sizeof(char));
format->sec_size = section.sh_size;