summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elf/format.c47
-rw-r--r--plugins/mobicore/mclf.c19
2 files changed, 23 insertions, 43 deletions
diff --git a/plugins/elf/format.c b/plugins/elf/format.c
index a5c8c92..9e3b636 100644
--- a/plugins/elf/format.c
+++ b/plugins/elf/format.c
@@ -255,44 +255,37 @@ GBinFormat *g_elf_format_new(GBinContent *content, GExeFormat *parent, GtkStatus
g_binary_format_set_content(base, content);
if (!read_elf_header(result, &result->header, &result->is_32b, &result->endian))
- {
- /* TODO */
- return NULL;
- }
-
+ goto gefn_error;
/* Vérification des tailles d'entrée de table */
if (ELF_HDR(result, result->header, e_phentsize) != ELF_SIZEOF_PHDR(result))
{
- log_variadic_message(LMT_BAD_BINARY, _("Corrupted program header size (%hu); fixed! -- replacing 0x%04hx by 0x%04hx at offset 0x%x"),
+ log_variadic_message(LMT_BAD_BINARY,
+ _("Corrupted program header size (%hu); fixed!" \
+ " -- replacing 0x%04hx by 0x%04hx at offset 0x%x"),
ELF_HDR(result, result->header, e_phentsize),
ELF_HDR(result, result->header, e_phentsize),
- ELF_SIZEOF_PHDR(result), ELF_HDR_OFFSET_OF(result, e_phentsize));
+ ELF_SIZEOF_PHDR(result),
+ ELF_HDR_OFFSET_OF(result, e_phentsize));
+
ELF_HDR_SET(result, result->header, e_phentsize, ELF_SIZEOF_PHDR(result));
+
}
if (ELF_HDR(result, result->header, e_shentsize) != ELF_SIZEOF_SHDR(result))
{
- log_variadic_message(LMT_BAD_BINARY, _("Corrupted section header size (%hu); fixed! -- replacing 0x%04hx by 0x%04hx at offset 0x%x"),
+ log_variadic_message(LMT_BAD_BINARY,
+ _("Corrupted section header size (%hu); fixed!" \
+ " -- replacing 0x%04hx by 0x%04hx at offset 0x%x"),
ELF_HDR(result, result->header, e_shentsize),
ELF_HDR(result, result->header, e_shentsize),
- ELF_SIZEOF_SHDR(result), ELF_HDR_OFFSET_OF(result, e_shentsize));
+ ELF_SIZEOF_SHDR(result),
+ ELF_HDR_OFFSET_OF(result, e_shentsize));
+
ELF_HDR_SET(result, result->header, e_shentsize, ELF_SIZEOF_SHDR(result));
- }
- /* FIXME : à améliorer */
- /*
- if ((ELF_HDR(result, result->header, e_shnum) * ELF_HDR(result, result->header, e_shentsize)) >= length)
- {
- log_variadic_message(LMT_BAD_BINARY, ("Suspicious section table (bigger than the binary !) ; reset! -- replacing 0x%04hx by 0x%04hx at offset 0x%x"),
- ELF_HDR(result, result->header, e_shnum),
- 0, ELF_HDR_OFFSET_OF(result, e_shnum));
- ELF_HDR_SET(result, result->header, e_shnum, 0);
}
- */
-
-
/**
* On inscrit les éléments préchargés avant tout !
@@ -307,18 +300,10 @@ GBinFormat *g_elf_format_new(GBinContent *content, GExeFormat *parent, GtkStatus
if (!load_elf_symbols(result, status))
- {
- /* TODO */
- return NULL;
- }
-
+ goto gefn_error;
if (!find_all_elf_strings(result))
- {
- /* TODO */
- return NULL;
- }
-
+ goto gefn_error;
if (!g_executable_format_complete_loading(exe_format, status))
goto gefn_error;
diff --git a/plugins/mobicore/mclf.c b/plugins/mobicore/mclf.c
index 7697d15..653ffaa 100644
--- a/plugins/mobicore/mclf.c
+++ b/plugins/mobicore/mclf.c
@@ -210,24 +210,19 @@ GBinFormat *g_mclf_format_new(GBinContent *content, GExeFormat *parent, GtkStatu
g_binary_format_set_content(G_BIN_FORMAT(result), content);
-
-
if (!read_mclf_header(result, &result->header, result->endian))
- {
- /* TODO */
- return NULL;
- }
+ goto gmfn_error;
+ if (!load_mclf_symbols(result))
+ goto gmfn_error;
+ return G_BIN_FORMAT(result);
- if (!load_mclf_symbols(result))
- {
- /* TODO */
- return NULL;
- }
+ gmfn_error:
+ g_object_unref(G_OBJECT(result));
- return G_BIN_FORMAT(result);
+ return NULL;
}