about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com>2021-07-05 10:28:55 +0100
committerGitHub <noreply@github.com>2021-07-05 11:28:55 +0200
commitf7fb4495c4aa6a1e2eca17779f9a60a31b6dbdf1 (patch)
treeed74da96c4ce79ca6fe69664192356d2c77112f7
parentdcf450ecba2f3ad8ed00c02a00b84da97e14df77 (diff)
downloadafl++-f7fb4495c4aa6a1e2eca17779f9a60a31b6dbdf1.tar.gz
Fixes to handling DSOs by name (#1004)
Co-authored-by: Your Name <you@example.com>
-rw-r--r--frida_mode/src/ranges.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/frida_mode/src/ranges.c b/frida_mode/src/ranges.c
index 534f202b..05e18156 100644
--- a/frida_mode/src/ranges.c
+++ b/frida_mode/src/ranges.c
@@ -145,11 +145,13 @@ static void convert_name_token(gchar *token, GumMemoryRange *range) {
 
 static void convert_token(gchar *token, GumMemoryRange *range) {
 
-  if (g_strrstr(token, "-")) {
+  if (g_str_has_prefix(token, "0x")) {
 
     convert_address_token(token, range);
 
-  } else {
+  }
+
+  else {
 
     convert_name_token(token, range);
 
@@ -509,6 +511,13 @@ void ranges_config(void) {
   if (getenv("AFL_FRIDA_DEBUG_MAPS") != NULL) { ranges_debug_maps = TRUE; }
   if (getenv("AFL_INST_LIBS") != NULL) { ranges_inst_libs = TRUE; }
 
+  if (ranges_debug_maps) {
+
+    gum_process_enumerate_ranges(GUM_PAGE_NO_ACCESS, print_ranges_callback,
+                                 NULL);
+
+  }
+
   include_ranges = collect_ranges("AFL_FRIDA_INST_RANGES");
   exclude_ranges = collect_ranges("AFL_FRIDA_EXCLUDE_RANGES");
 
@@ -522,13 +531,6 @@ void ranges_init(void) {
   GArray *       step3;
   GArray *       step4;
 
-  if (ranges_debug_maps) {
-
-    gum_process_enumerate_ranges(GUM_PAGE_NO_ACCESS, print_ranges_callback,
-                                 NULL);
-
-  }
-
   OKF("Ranges - Instrument libraries [%c]", ranges_inst_libs ? 'X' : ' ');
 
   print_ranges("AFL_FRIDA_INST_RANGES", include_ranges);