summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-03-25 09:43:57 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-03-25 09:43:57 (GMT)
commit8e275f286138db88140d1643d1008f130ba7f484 (patch)
treeeea120992ae5a9c2a341e3bee336620ecdc65a6f
parentfd0df8f884336fc69bd0938453f9712c166f08c8 (diff)
Avoided stack overflows with empty dynamic parameters.
-rw-r--r--plugins/dwarf/format.c2
-rw-r--r--plugins/elf/symbols.c2
-rw-r--r--plugins/ropgadgets/select.c2
-rw-r--r--src/analysis/disass/limit.c2
-rw-r--r--src/arch/target.c4
-rw-r--r--src/arch/vmpa.h3
-rw-r--r--src/core/params.c8
-rw-r--r--src/glibext/gbuffercache.c2
-rw-r--r--src/gtkext/gtkstatusstack.c2
-rw-r--r--src/gui/panels/strings.c2
-rw-r--r--src/plugins/plugin.c10
11 files changed, 21 insertions, 18 deletions
diff --git a/plugins/dwarf/format.c b/plugins/dwarf/format.c
index e071f1c..cb042b7 100644
--- a/plugins/dwarf/format.c
+++ b/plugins/dwarf/format.c
@@ -85,7 +85,7 @@ GDbgFormat *check_dwarf_format(GExeFormat *format)
matched = true;
for (i = 0; i < ARRAY_SIZE(section_names) && matched; i++)
- matched = g_exe_format_get_section_range_by_name(format, section_names[i], (mrange_t []) { 0 });
+ matched = g_exe_format_get_section_range_by_name(format, section_names[i], UNUSED_MRANGE_PTR);
if (matched)
result = g_dwarf_format_new(format);
diff --git a/plugins/elf/symbols.c b/plugins/elf/symbols.c
index 5ddc99c..46e5ff8 100644
--- a/plugins/elf/symbols.c
+++ b/plugins/elf/symbols.c
@@ -139,7 +139,7 @@ bool load_elf_symbols(GElfFormat *format, wgroup_id_t gid, GtkStatusStack *statu
/* Symboles importés et/ou exportés */
- if (find_elf_dynamic_program_header(format, (elf_phdr []) { 0 }))
+ if (find_elf_dynamic_program_header(format, (elf_phdr []) { { { 0 } } }))
{
log_variadic_message(LMT_INFO, _("Binary is dynamically linked"));
diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c
index 019855b..3e5e453 100644
--- a/plugins/ropgadgets/select.c
+++ b/plugins/ropgadgets/select.c
@@ -1530,7 +1530,7 @@ static void add_new_gadgets_for_category(GExeFormat *format, GtkComboBoxText *co
{
instr = chain->instrs[j];
- line = g_buffer_line_new((mrange_t []){ { { 0 }, 0 } }, BLC_ASSEMBLY);
+ line = g_buffer_line_new(UNUSED_MRANGE_PTR, BLC_ASSEMBLY);
g_line_generator_print(G_LINE_GENERATOR(instr), line, -1, 0, content);
if (j == 0)
diff --git a/src/analysis/disass/limit.c b/src/analysis/disass/limit.c
index 103f878..b0ac6fc 100644
--- a/src/analysis/disass/limit.c
+++ b/src/analysis/disass/limit.c
@@ -76,7 +76,7 @@ void compute_routine_limit(GBinSymbol *symbol, const vmpa2t *next, GArchProcesso
/* Dans tous les cas, on va se référer à la portion contenante... */
- portion = g_binary_portion_find_at_addr(portions, &addr, (GdkRectangle []) { });
+ portion = g_binary_portion_find_at_addr(portions, &addr, (GdkRectangle []) { { 0 } });
assert(portion != NULL);
range = g_binary_portion_get_range(portion);
diff --git a/src/arch/target.c b/src/arch/target.c
index d3bd89a..db4d058 100644
--- a/src/arch/target.c
+++ b/src/arch/target.c
@@ -274,8 +274,8 @@ static int g_target_operand_compare(const GTargetOperand *a, const GTargetOperan
}
else if (a->symbol != NULL && b->symbol != NULL)
{
- result = g_binary_symbol_cmp((const GBinSymbol * []) { a->symbol },
- (const GBinSymbol * []) { b->symbol });
+ result = g_binary_symbol_cmp((const GBinSymbol *[]) { a->symbol },
+ (const GBinSymbol *[]) { b->symbol });
if (result != 0) goto gtoc_done;
}
diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h
index d2cc39b..fc997e5 100644
--- a/src/arch/vmpa.h
+++ b/src/arch/vmpa.h
@@ -176,6 +176,9 @@ typedef struct _mrange_t
} mrange_t;
+#define UNUSED_MRANGE_PTR (mrange_t []) { { { 0 }, 0 } }
+
+
#define get_mrange_addr(r) &(r)->addr
#define get_mrange_length(r) (r)->length
diff --git a/src/core/params.c b/src/core/params.c
index 3d0880a..6467182 100644
--- a/src/core/params.c
+++ b/src/core/params.c
@@ -204,16 +204,16 @@ bool load_main_config_parameters(void)
param = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_STRINGS, CPT_INTEGER, 5);
if (param == NULL) return false;
- param = g_generic_config_create_param(config, MPK_LINK_DEFAULT, CPT_COLOR, ((GdkRGBA []) {{ 0, 0, 0, 1.0 }}));
+ param = g_generic_config_create_param(config, MPK_LINK_DEFAULT, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0, 1.0 } }));
if (param == NULL) return false;
- param = g_generic_config_create_param(config, MPK_LINK_BRANCH_TRUE, CPT_COLOR, ((GdkRGBA []) {{ 0, 0.6, 0, 1.0 }}));
+ param = g_generic_config_create_param(config, MPK_LINK_BRANCH_TRUE, CPT_COLOR, ((GdkRGBA []) { { 0, 0.6, 0, 1.0 } }));
if (param == NULL) return false;
- param = g_generic_config_create_param(config, MPK_LINK_BRANCH_FALSE, CPT_COLOR, ((GdkRGBA []) {{ 0.8, 0, 0, 1.0 }}));
+ param = g_generic_config_create_param(config, MPK_LINK_BRANCH_FALSE, CPT_COLOR, ((GdkRGBA []) { { 0.8, 0, 0, 1.0 } }));
if (param == NULL) return false;
- param = g_generic_config_create_param(config, MPK_LINK_LOOP, CPT_COLOR, ((GdkRGBA []) {{ 0, 0, 0.8, 1.0 }}));
+ param = g_generic_config_create_param(config, MPK_LINK_LOOP, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0.8, 1.0 } }));
if (param == NULL) return false;
param = g_generic_config_create_param(config, MPK_KEYBINDINGS_EDIT, CPT_STRING, "<Shift>F2");
diff --git a/src/glibext/gbuffercache.c b/src/glibext/gbuffercache.c
index 8d02dd8..82d77c0 100644
--- a/src/glibext/gbuffercache.c
+++ b/src/glibext/gbuffercache.c
@@ -449,7 +449,7 @@ static GBufferLine *get_cache_info_line(cache_info *info, size_t index, const GB
if (result == NULL)
{
- result = g_buffer_line_new((mrange_t []){ { { 0 }, 0 } }, 0/* !! */);
+ result = g_buffer_line_new(UNUSED_MRANGE_PTR, 0/* !! */);
g_object_add_toggle_ref(G_OBJECT(result), (GToggleNotify)on_line_ref_toggle, info);
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index e36c406..45bd667 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -547,7 +547,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL
portions = g_exe_format_get_portions(format);
- portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { });
+ portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { { 0 } });
text = g_binary_portion_get_desc(portion);
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c
index 048fa28..8248c08 100644
--- a/src/gui/panels/strings.c
+++ b/src/gui/panels/strings.c
@@ -776,7 +776,7 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat
vmpa2_phys_to_string(addr, size, phys, NULL);
vmpa2_virt_to_string(addr, size, virt, NULL);
- portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { });
+ portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { { 0 } });
area = g_binary_portion_get_desc(portion);
g_object_unref(G_OBJECT(portion));
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 1bdcf04..27f1871 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -260,11 +260,11 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
/* Localisation des différents points d'entrée déclarés */
-#define check_plugin_symbol(mod, sym) \
- ({ \
- bool __result; \
- __result = g_module_symbol(mod, sym, (gpointer []) { 0 }); \
- __result; \
+#define check_plugin_symbol(mod, sym) \
+ ({ \
+ bool __result; \
+ __result = g_module_symbol(mod, sym, (gpointer []) { NULL }); \
+ __result; \
})