about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-04-27 22:10:08 +0200
committervan Hauser <vh@thc.org>2020-04-27 22:10:08 +0200
commit087c368242f7db2da2564617acf6dd63bf8b671c (patch)
tree63acd8b14d2d5bcfbb6272c6403d90d7241a3d0d
parenta56354a893fa5aa330773fbd0c28c5561ad1ea51 (diff)
downloadafl++-087c368242f7db2da2564617acf6dd63bf8b671c.tar.gz
better fix for showmap
-rw-r--r--src/afl-showmap.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 98280203..3b3bdefe 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -779,14 +779,6 @@ int main(int argc, char **argv_orig, char **envp) {
 
   set_up_environment(fsrv);
 
-  i = 0;
-  while (argv[i] != NULL && !arg_offset) {
-
-    if (strcmp(argv[i], "@@") == 0) arg_offset = i;
-    i++;
-
-  }
-
   fsrv->target_path = find_binary(argv[optind]);
 
   if (!quiet_mode) {
@@ -827,11 +819,10 @@ int main(int argc, char **argv_orig, char **envp) {
 
   }
 
-  int arg_offset2 = 0;
   i = 0;
-  while (use_argv[i] != NULL && !arg_offset2) {
+  while (use_argv[i] != NULL && !arg_offset) {
 
-    if (strcmp(use_argv[i], "@@") == 0) { arg_offset2 = i; }
+    if (strcmp(use_argv[i], "@@") == 0) { arg_offset = i; }
     i++;
 
   }
@@ -880,11 +871,9 @@ int main(int argc, char **argv_orig, char **envp) {
     fsrv->out_fd = open(stdin_file, O_RDWR | O_CREAT | O_EXCL, 0600);
     if (fsrv->out_fd < 0) { PFATAL("Unable to create '%s'", out_file); }
 
-    if (arg_offset && use_argv[arg_offset] != stdin_file) {
+    if (use_argv[arg_offset] != stdin_file) {
 
-      ck_free(argv[arg_offset]);
-      argv[arg_offset] = strdup(stdin_file);
-      use_argv[arg_offset2] = argv[arg_offset];
+      use_argv[arg_offset] = strdup(stdin_file);
 
     }