summaryrefslogtreecommitdiff
path: root/src/format/elf/section.c
diff options
context:
space:
mode:
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;