diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-04-19 19:25:04 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-04-19 19:25:04 (GMT) |
commit | c177597d6da5dedb32aa176e8370db8ffb7f87aa (patch) | |
tree | 26f7eb2702ba4aa3dfd7267d74fe78ad79791a8c /plugins | |
parent | 35f37c72e9d81e478395914da6c10b3c546761a7 (diff) |
Handled static strings as well as dynamic strings in comments.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/pychrysa/analysis/db/items/comment.c | 19 | ||||
-rw-r--r-- | plugins/readelf/header.c | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c index 4a90f09..1062cc9 100644 --- a/plugins/pychrysa/analysis/db/items/comment.c +++ b/plugins/pychrysa/analysis/db/items/comment.c @@ -25,6 +25,7 @@ #include "comment.h" +#include <malloc.h> #include <pygobject.h> @@ -108,13 +109,25 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject static PyObject *py_db_comment_get_text(PyObject *self, void *closure) { + PyObject *result; /* Résultat à retourner */ GDbComment *comment; /* Commentaire à consulter */ - const char *content; /* Contenu textuel associé */ + char *text; /* Contenu textuel associé */ comment = G_DB_COMMENT(pygobject_get(self)); - content = g_db_comment_get_text(comment); + text = g_db_comment_get_text(comment); - return PyUnicode_FromString(content); + if (text == NULL) + { + result = Py_None; + Py_INCREF(result); + } + else + { + result = PyUnicode_FromString(text); + free(text); + } + + return result; } diff --git a/plugins/readelf/header.c b/plugins/readelf/header.c index 75e30fe..d0aee92 100644 --- a/plugins/readelf/header.c +++ b/plugins/readelf/header.c @@ -70,7 +70,7 @@ bool annotate_elf_header(GElfFormat *format) SET_IMM_DISPLAY(instr, operand, 2, IOD_CHAR); SET_IMM_DISPLAY(instr, operand, 3, IOD_CHAR); - ADD_RAW_AS_SYM(format, symbol, instr, comment, _("ELF magic number")); + ADD_RAW_AS_SYM_CST(format, symbol, instr, comment, _("ELF magic number")); /* EI_CLASS (4) */ |