summaryrefslogtreecommitdiff
path: root/plugins/elf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-09-06 20:45:36 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-09-06 20:45:36 (GMT)
commit9aaaa651d924eb30e46f26690aea007b7d868e35 (patch)
tree846d8f5d27bc7c289a6b0241f1ad3fbe2510f1c6 /plugins/elf
parent9dac560b09bfea058e0286b1a5cd25c37290af39 (diff)
Fixed possible UAFs when adding symbols.
Diffstat (limited to 'plugins/elf')
-rw-r--r--plugins/elf/strings.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/elf/strings.c b/plugins/elf/strings.c
index 4d6b5c8..7dd644e 100644
--- a/plugins/elf/strings.c
+++ b/plugins/elf/strings.c
@@ -356,6 +356,9 @@ static bool do_elf_string_loading(GElfLoading *loading, GElfFormat *format, phys
range = g_arch_instruction_get_range(instr);
symbol = g_string_symbol_new_read_only(base, range, SET_GUESS);
+
+ g_object_ref(G_OBJECT(symbol));
+
g_binary_format_add_symbol(base, symbol);
/* Jointure avec la chaîne précédente ? */
@@ -368,6 +371,8 @@ static bool do_elf_string_loading(GElfLoading *loading, GElfFormat *format, phys
if (cut)
g_string_symbol_build_label(G_STR_SYMBOL(symbol), base);
+ g_object_unref(G_OBJECT(symbol));
+
}
/* Conclusion */