Fix: lttng-elf: untrusted entry size divisor
[lttng-tools.git] / src / common / lttng-elf.c
index 816dd0d7621a15a3dc6b2f073c2acc9a583fa02a..7369f29c517cd9489d78ab2bfc9bd7756c0f90f9 100644 (file)
@@ -750,7 +750,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        char *curr_sym_str = NULL;
        char *symbol_table_data = NULL;
        char *string_table_data = NULL;
-       char *string_table_name = NULL;
+       const char *string_table_name = NULL;
        struct lttng_elf_shdr symtab_hdr;
        struct lttng_elf_shdr strtab_hdr;
        struct lttng_elf *elf = NULL;
@@ -814,6 +814,12 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        }
 
        /* Get the number of symbol in the table for the iteration. */
+       if (symtab_hdr.sh_entsize == 0) {
+               DBG("Invalid ELF string table entry size.");
+               ret = LTTNG_ERR_ELF_PARSING;
+               goto free_symbol_table_data;
+       }
+
        sym_count = symtab_hdr.sh_size / symtab_hdr.sh_entsize;
 
        /* Loop over all symbol. */
This page took 0.025033 seconds and 4 git commands to generate.