summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c29
-rw-r--r--src/analysis/binary.h3
-rw-r--r--src/analysis/content-int.h2
-rw-r--r--src/analysis/content.c44
-rw-r--r--src/analysis/content.h2
-rw-r--r--src/analysis/contents/encapsulated.c12
-rw-r--r--src/analysis/contents/file.c17
-rw-r--r--src/analysis/contents/memory.c8
-rw-r--r--src/analysis/disass/disassembler.c4
9 files changed, 58 insertions, 63 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index aee4499..c671827 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -400,35 +400,6 @@ GLoadedContent *g_loaded_binary_new(GExeFormat *format)
}
-/******************************************************************************
-* *
-* Paramètres : binary = élément binaire à consulter. *
-* full = précise s'il s'agit d'une version longue ou non. *
-* *
-* Description : Fournit le nom associé à l'élément binaire. *
-* *
-* Retour : Nom de fichier avec chemin absolu. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const char *g_loaded_binary_get_name(const GLoadedBinary *binary, bool full)
-{
- const char *result; /* Description à retourner */
- GBinContent *content; /* Contenu binaire mannipulé */
-
- content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
-
- result = g_binary_content_describe(content, full);
-
- g_object_unref(G_OBJECT(content));
-
- return result;
-
-}
-
-
/* ---------------------------------------------------------------------------------- */
/* INFORMATIONS D'ENREGISTREMENTS */
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 74c5f7f..178d186 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -76,9 +76,6 @@ GType g_loaded_binary_get_type(void);
/* Interprète un contenu binaire chargé. */
GLoadedContent *g_loaded_binary_new(GExeFormat *);
-/* Fournit le nom associé à l'élément binaire. */
-const char *g_loaded_binary_get_name(const GLoadedBinary *, bool);
-
/* ------------------------- INFORMATIONS D'ENREGISTREMENTS ------------------------- */
diff --git a/src/analysis/content-int.h b/src/analysis/content-int.h
index ad13b8d..886c196 100644
--- a/src/analysis/content-int.h
+++ b/src/analysis/content-int.h
@@ -39,7 +39,7 @@ typedef GContentAttributes * (* get_content_attributes) (const GBinContent *);
typedef GBinContent * (* get_content_root_fc) (GBinContent *);
/* Fournit le nom associé au contenu binaire. */
-typedef const char * (* describe_content_fc) (const GBinContent *, bool);
+typedef char * (* describe_content_fc) (const GBinContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
typedef bool (* save_content_fc) (const GBinContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
diff --git a/src/analysis/content.c b/src/analysis/content.c
index 86fa490..8b83261 100644
--- a/src/analysis/content.c
+++ b/src/analysis/content.c
@@ -197,14 +197,14 @@ GBinContent *g_binary_content_get_root(GBinContent *content)
* *
******************************************************************************/
-const char *g_binary_content_describe(const GBinContent *content, bool full)
+char *g_binary_content_describe(const GBinContent *content, bool full)
{
char *result; /* Description à retourner */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- result = strdup(iface->describe(content, full));
+ result = iface->describe(content, full);
return result;
@@ -418,11 +418,14 @@ const bin_t *g_binary_content_get_raw_access(const GBinContent *content, vmpa2t
bool g_binary_content_read_raw(const GBinContent *content, vmpa2t *addr, phys_t length, bin_t *out)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_raw(content, addr, length, out);
+ result = iface->read_raw(content, addr, length, out);
+
+ return result;
}
@@ -444,11 +447,14 @@ bool g_binary_content_read_raw(const GBinContent *content, vmpa2t *addr, phys_t
bool g_binary_content_read_u4(const GBinContent *content, vmpa2t *addr, bool *low, uint8_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_u4(content, addr, low, val);
+ result = iface->read_u4(content, addr, low, val);
+
+ return result;
}
@@ -470,11 +476,14 @@ bool g_binary_content_read_u4(const GBinContent *content, vmpa2t *addr, bool *lo
bool g_binary_content_read_u8(const GBinContent *content, vmpa2t *addr, uint8_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_u8(content, addr, val);
+ result = iface->read_u8(content, addr, val);
+
+ return result;
}
@@ -496,11 +505,14 @@ bool g_binary_content_read_u8(const GBinContent *content, vmpa2t *addr, uint8_t
bool g_binary_content_read_u16(const GBinContent *content, vmpa2t *addr, SourceEndian endian, uint16_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_u16(content, addr, endian, val);
+ result = iface->read_u16(content, addr, endian, val);
+
+ return result;
}
@@ -522,11 +534,14 @@ bool g_binary_content_read_u16(const GBinContent *content, vmpa2t *addr, SourceE
bool g_binary_content_read_u32(const GBinContent *content, vmpa2t *addr, SourceEndian endian, uint32_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_u32(content, addr, endian, val);
+ result = iface->read_u32(content, addr, endian, val);
+
+ return result;
}
@@ -548,11 +563,14 @@ bool g_binary_content_read_u32(const GBinContent *content, vmpa2t *addr, SourceE
bool g_binary_content_read_u64(const GBinContent *content, vmpa2t *addr, SourceEndian endian, uint64_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_u64(content, addr, endian, val);
+ result = iface->read_u64(content, addr, endian, val);
+
+ return result;
}
@@ -573,11 +591,14 @@ bool g_binary_content_read_u64(const GBinContent *content, vmpa2t *addr, SourceE
bool g_binary_content_read_uleb128(const GBinContent *content, vmpa2t *addr, uleb128_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_uleb128(content, addr, val);
+ result = iface->read_uleb128(content, addr, val);
+
+ return result;
}
@@ -598,10 +619,13 @@ bool g_binary_content_read_uleb128(const GBinContent *content, vmpa2t *addr, ule
bool g_binary_content_read_leb128(const GBinContent *content, vmpa2t *addr, leb128_t *val)
{
+ bool result; /* Bilan à remonter */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->read_leb128(content, addr, val);
+ result = iface->read_leb128(content, addr, val);
+
+ return result;
}
diff --git a/src/analysis/content.h b/src/analysis/content.h
index 9f901e7..d7f5536 100644
--- a/src/analysis/content.h
+++ b/src/analysis/content.h
@@ -68,7 +68,7 @@ GContentAttributes *g_binary_content_get_attributes(const GBinContent *);
GBinContent *g_binary_content_get_root(GBinContent *);
/* Fournit le nom associé au contenu binaire. */
-const char *g_binary_content_describe(const GBinContent *, bool);
+char *g_binary_content_describe(const GBinContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
bool g_binary_content_save(const GBinContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
diff --git a/src/analysis/contents/encapsulated.c b/src/analysis/contents/encapsulated.c
index 569df10..59b0c9e 100644
--- a/src/analysis/contents/encapsulated.c
+++ b/src/analysis/contents/encapsulated.c
@@ -74,7 +74,7 @@ static void g_encaps_content_finalize(GEncapsContent *);
static GBinContent *g_encaps_content_get_root(GEncapsContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_encaps_content_describe(const GEncapsContent *, bool);
+static char *g_encaps_content_describe(const GEncapsContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_encaps_content_save(const GEncapsContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -296,7 +296,7 @@ GBinContent *g_encaps_content_new(GBinContent *base, const char *path, GBinConte
/* Description complète */
- result->full_desc = stradd(result->full_desc, g_binary_content_describe(result->base, true));
+ result->full_desc = g_binary_content_describe(result->base, true);
result->full_desc = stradd(result->full_desc, G_DIR_SEPARATOR_S);
@@ -416,14 +416,14 @@ static GBinContent *g_encaps_content_get_root(GEncapsContent *content)
* *
******************************************************************************/
-static const char *g_encaps_content_describe(const GEncapsContent *content, bool full)
+static char *g_encaps_content_describe(const GEncapsContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
if (full)
- result = content->full_desc;
+ result = strdup(content->full_desc);
else
- result = content->desc;
+ result = strdup(content->desc);
return result;
diff --git a/src/analysis/contents/file.c b/src/analysis/contents/file.c
index b133336..7bb0be8 100644
--- a/src/analysis/contents/file.c
+++ b/src/analysis/contents/file.c
@@ -86,7 +86,7 @@ static GContentAttributes *g_file_content_get_attributes(const GFileContent *);
static GBinContent *g_file_content_get_root(GFileContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_file_content_describe(const GFileContent *, bool);
+static char *g_file_content_describe(const GFileContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_file_content_save(const GFileContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -489,22 +489,23 @@ static GBinContent *g_file_content_get_root(GFileContent *content)
* *
******************************************************************************/
-static const char *g_file_content_describe(const GFileContent *content, bool full)
+static char *g_file_content_describe(const GFileContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
+ const char *sep; /* Caractère de séparation */
if (full)
- result = content->filename;
+ result = strdup(content->filename);
else
{
- result = strrchr(content->filename, G_DIR_SEPARATOR);
+ sep = strrchr(content->filename, G_DIR_SEPARATOR);
- if (result == NULL)
- result = content->filename;
+ if (sep == NULL)
+ result = strdup(content->filename);
else
- result++;
+ result = strdup(++sep);
}
diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c
index 232a41d..a37a7d4 100644
--- a/src/analysis/contents/memory.c
+++ b/src/analysis/contents/memory.c
@@ -77,7 +77,7 @@ static void g_memory_content_finalize(GMemoryContent *);
static GBinContent *g_memory_content_get_root(GMemoryContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_memory_content_describe(const GMemoryContent *, bool);
+static char *g_memory_content_describe(const GMemoryContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_memory_content_save(const GMemoryContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -399,11 +399,11 @@ static GBinContent *g_memory_content_get_root(GMemoryContent *content)
* *
******************************************************************************/
-static const char *g_memory_content_describe(const GMemoryContent *content, bool full)
+static char *g_memory_content_describe(const GMemoryContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
- result = "In-memory content";
+ result = strdup("In-memory content");
return result;
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index 607f1e4..af67fdf 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -389,7 +389,7 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS
GBinContent *content; /* Contenu bianire manipulé */
GCodingLanguage *lang; /* Langage de sortie préféré */
char **text; /* Contenu brute à imprimer */
- const char *desc; /* Désignation du binaire */
+ char *desc; /* Désignation du binaire */
const gchar *checksum; /* Identifiant de binaire */
GIntroGenerator *generator; /* Générateur constitué */
@@ -420,6 +420,8 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS
asprintf(&text[2], "%s%s", _("Source: "), desc);
+ free(desc);
+
/* Checksum SHA256 */
checksum = g_binary_content_get_checksum(content);