summaryrefslogtreecommitdiff
path: root/src/model/section-name.c
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2013-02-23 01:46:32 +0000
committernorly <ny-git@enpas.org>2013-02-23 01:49:43 +0000
commit58b6f8de8862c9ccba763d3607afb5495727e4d6 (patch)
treeca23423174e1238cebc4f77ab3602bf0b8e4864e /src/model/section-name.c
parent7b04e102bb2ad0189f66d4878fe92d6fa22a1990 (diff)
Add run-time sanity checks
Diffstat (limited to 'src/model/section-name.c')
-rw-r--r--src/model/section-name.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/model/section-name.c b/src/model/section-name.c
new file mode 100644
index 0000000..0e5d903
--- /dev/null
+++ b/src/model/section-name.c
@@ -0,0 +1,27 @@
+#include <assert.h>
+#include <stdlib.h>
+
+#include <libelf.h>
+#include <gelf.h>
+
+#include <libelfu/libelfu.h>
+
+
+
+char* elfu_modelScnName(ElfuElf *me, ElfuScn *ms)
+{
+ assert(me);
+ assert(ms);
+
+ if (!me->shstrtab) {
+ return NULL;
+ }
+
+ if (CIRCLEQ_EMPTY(&me->shstrtab->dataList)) {
+ return NULL;
+ }
+
+ /* Don't take multiple data parts into account. */
+ ElfuData *md = me->shstrtab->dataList.cqh_first;
+ return &((char*)md->data.d_buf)[ms->shdr.sh_name];
+}