summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-04 12:39:01 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-04 12:39:01 (GMT)
commitade3ee4fd3b78e96deb08210838643969f2f6699 (patch)
tree09003a6f4ac00c09560de9ea9a91c125a7b14f68 /plugins
parenta0463dfa8fe232d01ea925668f393d7507fa787b (diff)
Updated the API for building symbol labels.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elf/symbols.c16
-rw-r--r--plugins/pychrysalide/analysis/routine.c1
-rw-r--r--plugins/pychrysalide/format/symbol.c6
3 files changed, 17 insertions, 6 deletions
diff --git a/plugins/elf/symbols.c b/plugins/elf/symbols.c
index 949e495..90b9488 100644
--- a/plugins/elf/symbols.c
+++ b/plugins/elf/symbols.c
@@ -1185,7 +1185,7 @@ static bool do_elf_relocation_renaming(GElfLoading *loading, GElfFormat *format,
uint64_t index; /* Indice du symbole concerné */
char *name; /* Nouvelle désignation */
#ifndef NDEBUG
- const char *label; /* Etiquette courante */
+ char *label; /* Etiquette courante */
#endif
result = false;
@@ -1225,11 +1225,17 @@ static bool do_elf_relocation_renaming(GElfLoading *loading, GElfFormat *format,
label = g_binary_symbol_get_label(symbol);
- if (strncmp(label, "sub_", 4) != 0 && strncmp(label, "loc_", 4) != 0)
+ if (label != NULL)
{
- if (strncmp(name, label, strlen(label)) != 0)
- g_binary_format_add_error(G_BIN_FORMAT(format), BFE_SPECIFICATION, get_mrange_addr(range),
- _("Mismatch detected in the ELF symbol address"));
+ if (strncmp(label, "sub_", 4) != 0 && strncmp(label, "loc_", 4) != 0)
+ {
+ if (strncmp(name, label, strlen(label)) != 0)
+ g_binary_format_add_error(G_BIN_FORMAT(format), BFE_SPECIFICATION, get_mrange_addr(range),
+ _("Mismatch detected in the ELF symbol address"));
+ }
+
+ free(label);
+
}
#endif
diff --git a/plugins/pychrysalide/analysis/routine.c b/plugins/pychrysalide/analysis/routine.c
index f8bc009..a95131d 100644
--- a/plugins/pychrysalide/analysis/routine.c
+++ b/plugins/pychrysalide/analysis/routine.c
@@ -139,6 +139,7 @@ static PyObject *py_binary_routine_get_name(PyObject *self, void *closure)
if (name != NULL)
result = PyUnicode_FromString(name);
+
else
{
result = Py_None;
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c
index ae13cf2..7dcb0eb 100644
--- a/plugins/pychrysalide/format/symbol.c
+++ b/plugins/pychrysalide/format/symbol.c
@@ -25,6 +25,7 @@
#include "symbol.h"
+#include <malloc.h>
#include <pygobject.h>
@@ -238,13 +239,16 @@ static PyObject *py_binary_symbol_get_label(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GBinSymbol *symbol; /* Elément à consulter */
- const char *label; /* Désignation courante */
+ char *label; /* Désignation courante */
symbol = G_BIN_SYMBOL(pygobject_get(self));
label = g_binary_symbol_get_label(symbol);
if (label != NULL)
+ {
result = PyUnicode_FromString(label);
+ free(label);
+ }
else
{