symtab never return null symbol
This commit is contained in:
parent
f918f8fe1c
commit
b6526332c6
2 changed files with 2 additions and 1 deletions
|
@ -50,11 +50,12 @@ int symtab_push(struct symbol_table *symtab, const Elf32_Sym *sym)
|
||||||
int symtab_get(struct symbol_table *symtab, Elf32_Sym **res, const char *name,
|
int symtab_get(struct symbol_table *symtab, Elf32_Sym **res, const char *name,
|
||||||
int32_t obj_idx)
|
int32_t obj_idx)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < symtab->len; i++) {
|
for (size_t i = 1; i < symtab->len; i++) {
|
||||||
Elf32_Sym *sym = &symtab->syms[i];
|
Elf32_Sym *sym = &symtab->syms[i];
|
||||||
const char *symname = symtab->strtab->data + B32(sym->st_name);
|
const char *symname = symtab->strtab->data + B32(sym->st_name);
|
||||||
if (strcmp(name, symname) != 0)
|
if (strcmp(name, symname) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// only allow retrevial of local variables from the
|
// only allow retrevial of local variables from the
|
||||||
// same object
|
// same object
|
||||||
if (sym->st_info >> 4 != STB_GLOBAL && symtab->map != NULL &&
|
if (sym->st_info >> 4 != STB_GLOBAL && symtab->map != NULL &&
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue