about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-04-29 15:09:20 +0200
committervanhauser-thc <vh@thc.org>2021-04-29 15:09:20 +0200
commit17b860d811cbd7695ab9756671c3f2d876ab25e8 (patch)
tree9ddb6c5ca093b105f21cf3f336294e8833800813
parent29dbe665a7a7dc6b2232487dbc6c1ebecbbdfb06 (diff)
downloadafl++-17b860d811cbd7695ab9756671c3f2d876ab25e8.tar.gz
nits
-rw-r--r--frida_mode/src/util.c10
-rwxr-xr-xfrida_mode/update_frida_version.sh13
2 files changed, 18 insertions, 5 deletions
diff --git a/frida_mode/src/util.c b/frida_mode/src/util.c
index f42afd64..bd13781d 100644
--- a/frida_mode/src/util.c
+++ b/frida_mode/src/util.c
@@ -14,22 +14,22 @@ guint64 util_read_address(char *key) {
 
   }
 
-  value_str = &value_str[2];
+  char *value_str2 = &value_str[2];
 
-  for (char *c = value_str; *c != '\0'; c++) {
+  for (char *c = value_str2; *c != '\0'; c++) {
 
     if (!g_ascii_isxdigit(*c)) {
 
-      FATAL("Invalid address not formed of hex digits: %s\n", value_str);
+      FATAL("Invalid address not formed of hex digits: %s ('%c')\n", value_str, *c);
 
     }
 
   }
 
-  guint64 value = g_ascii_strtoull(value_str, NULL, 16);
+  guint64 value = g_ascii_strtoull(value_str2, NULL, 16);
   if (value == 0) {
 
-    FATAL("Invalid address failed hex conversion: %s\n", value_str);
+    FATAL("Invalid address failed hex conversion: %s\n", value_str2);
 
   }
 
diff --git a/frida_mode/update_frida_version.sh b/frida_mode/update_frida_version.sh
new file mode 100755
index 00000000..7d938712
--- /dev/null
+++ b/frida_mode/update_frida_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+test -n "$1" && { echo This script has no options. It updates the referenced Frida version in GNUmakefile to the most current one. ; exit 1 ; }
+
+OLD=$(egrep '^GUM_DEVKIT_VERSION=' GNUmakefile 2>/dev/null|awk -F= '{print$2}')
+NEW=$(curl https://github.com/frida/frida/releases/ 2>/dev/null|egrep 'frida-gum-devkit-[0-9.]*-linux-x86_64'|head -n 1|sed 's/.*frida-gum-devkit-//'|sed 's/-linux.*//')
+
+echo Current set version: $OLD
+echo Newest available version: $NEW
+
+test -z "$OLD" -o -z "$NEW" -o "$OLD" = "$NEW" && { echo Nothing to be done. ; exit 0 ; }
+
+sed -i "s/=$OLD/=$NEW/" GNUmakefile || exit 1
+echo Successfully updated GNUmakefile