Skip to content

Commit

Permalink
Fix reading segment count for ELF ##endian
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored May 13, 2024
1 parent ee54918 commit a06c618
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion libr/anal/c/tccgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ static void struct_decl(TCCState *s1, CType *type, int u, bool is_typedef) {
next (s1);
// eprintf ("TOK %d %c\n", s1->tok, s1->tok);
iota = expr_const (s1);
eprintf ("IOTA %d\n", iota);
// eprintf ("TOK %d %c\n", s1->tok, s1->tok);
//const char *valstr = get_tok_str (s1, s1->ch, NULL);
//eprintf ("TOK %d %s\n", s1->ch, valstr);
Expand Down
6 changes: 5 additions & 1 deletion libr/bin/format/elf/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ ut64 Elf_(get_phnum)(ELFOBJ *eo) {
if (r != sizeof (shdr)) {
return 0;
}
ut64 num = shdr.sh_info;
#if R_BIN_ELF64
ut64 num = r_read_ble64 (&shdr.sh_info, eo->endian);
#else
ut64 num = (ut64)r_read_ble32 (&shdr.sh_info, eo->endian);
#endif
if ((int) num < 1) {
return UT16_MAX;
}
Expand Down

0 comments on commit a06c618

Please sign in to comment.