summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-24 18:43:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-24 18:43:55 (GMT)
commit156d2e2f6beda2302552ac79678494d914fda05b (patch)
tree021825960b7ac3315a336fc085a4f1d07c05df39 /plugins
parent21537636cd8318cf5a720211619ad3c3023b52e9 (diff)
Replaced all remaining raw accesses to binary contents with the GBinContent wrapper in binary formats.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@555 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mobicore/annotations.c8
-rw-r--r--plugins/mobicore/mclf-int.c4
-rw-r--r--plugins/mobicore/mclf.c4
-rw-r--r--plugins/pychrysa/glibext/bincontent.c2
-rw-r--r--plugins/readelf/header.c2
-rw-r--r--plugins/readelf/program.c2
-rw-r--r--plugins/readelf/section.c2
-rw-r--r--plugins/ropgadgets/finder.c2
-rw-r--r--plugins/ropgadgets/select.c6
9 files changed, 18 insertions, 14 deletions
diff --git a/plugins/mobicore/annotations.c b/plugins/mobicore/annotations.c
index 94fecaf..f6ffa55 100644
--- a/plugins/mobicore/annotations.c
+++ b/plugins/mobicore/annotations.c
@@ -72,7 +72,7 @@ static bool annotate_mclf_segment_descriptor(GMCLFFormat *format, const char *pr
GDbComment *comment; /* Définition de commentaire */
GBinSymbol *symbol; /* Symbole à intégrer */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
/* start */
@@ -123,7 +123,7 @@ static bool annotate_mclf_intro(GMCLFFormat *format, vmpa2t *pos)
GDbComment *comment; /* Définition de commentaire */
GBinSymbol *symbol; /* Symbole à intégrer */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
init_vmpa(pos, 0, format->header.v1.text.start);
@@ -170,7 +170,7 @@ static bool annotate_mclf_header_v1(GMCLFFormat *format, vmpa2t *pos)
GBinSymbol *symbol; /* Symbole à intégrer */
const char *text; /* Commentaire variable */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
/* flags */
@@ -358,7 +358,7 @@ static bool annotate_mclf_text_segment_header(GMCLFFormat *format, vmpa2t *pos)
GDbComment *comment; /* Définition de commentaire */
GBinSymbol *symbol; /* Symbole à intégrer */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
copy_vmpa(&old, pos);
init_vmpa(pos, 0x80, format->header.v1.text.start + 0x80);
diff --git a/plugins/mobicore/mclf-int.c b/plugins/mobicore/mclf-int.c
index 2f2300d..cb4dbb3 100644
--- a/plugins/mobicore/mclf-int.c
+++ b/plugins/mobicore/mclf-int.c
@@ -45,7 +45,7 @@ bool read_mclf_header(GMCLFFormat *format, mclf_header_t *header, SourceEndian e
GBinContent *content; /* Contenu binaire à lire */
vmpa2t pos; /* Position de lecture */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
init_vmpa(&pos, 0, VMPA_NO_VIRTUAL);
@@ -112,7 +112,7 @@ bool read_mclf_segment_desc(GMCLFFormat *format, segment_descriptor_t *segment,
bool result; /* Bilan à retourner */
GBinContent *content; /* Contenu binaire à lire */
- content = G_BIN_FORMAT(format)->conten_;
+ content = G_BIN_FORMAT(format)->content;
result = g_binary_content_read_u32(content, pos, endian, &segment->start);
result &= g_binary_content_read_u32(content, pos, endian, &segment->len);
diff --git a/plugins/mobicore/mclf.c b/plugins/mobicore/mclf.c
index c456c04..245508f 100644
--- a/plugins/mobicore/mclf.c
+++ b/plugins/mobicore/mclf.c
@@ -212,6 +212,7 @@ static void g_mclf_format_refine_portions(const GMCLFFormat *format, GBinPortion
{
GBinPortion *new; /* Nouvelle portion définie */
char desc[MAX_PORTION_DESC]; /* Description d'une portion */
+ phys_t length; /* Taille de portion globale */
vmpa2t addr; /* Emplacement dans le binaire */
/* Segment de code */
@@ -249,7 +250,8 @@ static void g_mclf_format_refine_portions(const GMCLFFormat *format, GBinPortion
sprintf(desc, "%s \"%s\"", _("Segment"), "sig");
g_binary_portion_set_desc(new, desc);
- init_vmpa(&addr, G_BIN_FORMAT(format)->length - 521, VMPA_NO_VIRTUAL); /* FIXME */
+ length = g_binary_content_compute_size(G_BIN_FORMAT(format)->content);
+ init_vmpa(&addr, length - 521, VMPA_NO_VIRTUAL); /* FIXME */
g_binary_portion_set_values(new, &addr, 521);
g_binary_portion_set_rights(new, PAC_READ | PAC_WRITE);
diff --git a/plugins/pychrysa/glibext/bincontent.c b/plugins/pychrysa/glibext/bincontent.c
index 5c9856e..a418c34 100644
--- a/plugins/pychrysa/glibext/bincontent.c
+++ b/plugins/pychrysa/glibext/bincontent.c
@@ -157,7 +157,7 @@ static PyObject *py_binary_content_read_u8(PyObject *self, PyObject *args)
addr = get_internal_vmpa(addr_obj);
if (addr == NULL) /* ... */;
- status = g_binary_content_read_u8(content, addr, /*SourceEndian endian*/0, &val);
+ status = g_binary_content_read_u8(content, addr, &val);
if (!status) return NULL;
printf("val :: 0x%02hhx\n", val);
diff --git a/plugins/readelf/header.c b/plugins/readelf/header.c
index d4dd706..6c7e171 100644
--- a/plugins/readelf/header.c
+++ b/plugins/readelf/header.c
@@ -55,7 +55,7 @@ bool annotate_elf_header(GElfFormat *format)
GBinSymbol *symbol; /* Symbole à intégrer */
const char *text; /* Texte constant à insérer */
- content = g_binary_format_get_conten_(G_BIN_FORMAT(format));
+ content = g_binary_format_get_content(G_BIN_FORMAT(format));
header = g_elf_format_get_header(format);
endian = g_elf_format_get_endianness(format);
diff --git a/plugins/readelf/program.c b/plugins/readelf/program.c
index ae10369..0a5ce7f 100644
--- a/plugins/readelf/program.c
+++ b/plugins/readelf/program.c
@@ -68,7 +68,7 @@ static bool annotate_elf_program_header(GElfFormat *format, SourceEndian endian,
if (!read_elf_program_header(format, get_phy_addr(pos), &phdr))
return false;
- content = g_binary_format_get_conten_(G_BIN_FORMAT(format));
+ content = g_binary_format_get_content(G_BIN_FORMAT(format));
/* Champ "p_type" */
diff --git a/plugins/readelf/section.c b/plugins/readelf/section.c
index 3884818..8445fc6 100644
--- a/plugins/readelf/section.c
+++ b/plugins/readelf/section.c
@@ -71,7 +71,7 @@ static bool annotate_elf_section_header(GElfFormat *format, SourceEndian endian,
if (!read_elf_section_header(format, get_phy_addr(pos), &shdr))
return false;
- content = g_binary_format_get_conten_(G_BIN_FORMAT(format));
+ content = g_binary_format_get_content(G_BIN_FORMAT(format));
/* Champ "sh_name" */
diff --git a/plugins/ropgadgets/finder.c b/plugins/ropgadgets/finder.c
index a63de93..3fbc0fd 100644
--- a/plugins/ropgadgets/finder.c
+++ b/plugins/ropgadgets/finder.c
@@ -331,7 +331,7 @@ found_rop_list *list_all_gadgets(GBinFormat *format, unsigned int max_depth, upd
g_object_ref(G_OBJECT(format));
domain.format = format;
- domain.content = g_binary_format_get_conten_(format);
+ domain.content = g_binary_format_get_content(format);
target = g_exe_format_get_target_machine(G_EXE_FORMAT(format));
domain.proc = get_arch_processor_for_type(target);
diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c
index 66c2add..826682c 100644
--- a/plugins/ropgadgets/select.c
+++ b/plugins/ropgadgets/select.c
@@ -1748,7 +1748,7 @@ static void add_new_gadgets_for_category(GBinFormat *format, GtkComboBoxText *co
const char *target; /* Sous-traitance requise */
GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille du bus d'adresses */
- const bin_t *content; /* Contenu binaire global */
+ const GBinContent *content; /* Contenu binaire global */
GCodeBuffer *buffer; /* Tampon de rassemblement */
size_t i; /* Boucle de parcours */
GArchInstruction *instr; /* Elément de liste de gadgets */
@@ -1770,7 +1770,7 @@ static void add_new_gadgets_for_category(GBinFormat *format, GtkComboBoxText *co
g_object_unref(G_OBJECT(proc));
- content = g_binary_format_get_content(G_BIN_FORMAT(format), NULL);
+ content = g_binary_format_get_content(G_BIN_FORMAT(format));
/* Conversion en contenu textuel */
@@ -1835,6 +1835,8 @@ static void add_new_gadgets_for_category(GBinFormat *format, GtkComboBoxText *co
g_object_unref(G_OBJECT(buffer));
+ g_object_unref(G_OBJECT(content));
+
/* Rajout de la catégorie et filtre au besoin */
gtk_combo_box_text_append_text(combo, category);