summaryrefslogtreecommitdiff
path: root/src/model/section-name.c
blob: fe3144801a1614c62cbd71a169ca489c0ab2ae4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <assert.h>
#include <stdlib.h>
#include <libelf.h>
#include <gelf.h>
#include <libelfu/libelfu.h>



char* elfu_mScnName(ElfuElf *me, ElfuScn *ms)
{
  assert(me);
  assert(ms);

  if (!me->shstrtab) {
    return NULL;
  }

  if (!me->shstrtab->data.d_buf) {
    return NULL;
  }

  return &((char*)me->shstrtab->data.d_buf)[ms->shdr.sh_name];
}