about summary refs log tree commit diff
path: root/src/afl-fuzz.c
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2021-05-01 14:03:28 +0200
committerhexcoder- <heiko@hexco.de>2021-05-01 14:03:28 +0200
commit6119c2eb5f4349c93abbeb19f0f9ec2f41aaabd1 (patch)
tree8f281c56c953bb8c18aef5a21f466c99b49cb8f1 /src/afl-fuzz.c
parentc6e8314446344d3a65b828feb31f627ce11ba352 (diff)
downloadafl++-6119c2eb5f4349c93abbeb19f0f9ec2f41aaabd1.tar.gz
remove the input file .cur_input at the end of the fuzzing, if AFL_TMPDIR is used
Diffstat (limited to 'src/afl-fuzz.c')
-rw-r--r--src/afl-fuzz.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 1b3e303c..8c3ba575 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -2212,6 +2212,31 @@ stop_fuzzing:
   }
 
   afl_fsrv_deinit(&afl->fsrv);
+
+  /* remove tmpfile */
+  if (afl->tmp_dir != NULL && !afl->in_place_resume) {
+
+    char tmpfile[PATH_MAX];
+
+    if (afl->file_extension) {
+
+      snprintf(tmpfile, PATH_MAX, "%s/.cur_input.%s", afl->tmp_dir,
+               afl->file_extension);
+
+    } else {
+
+      snprintf(tmpfile, PATH_MAX, "%s/.cur_input", afl->tmp_dir);
+
+    }
+
+    if (unlink(tmpfile) != 0) {
+
+      FATAL("Could not unlink current input file: %s.", tmpfile);
+
+    }
+
+  }
+
   if (afl->orig_cmdline) { ck_free(afl->orig_cmdline); }
   ck_free(afl->fsrv.target_path);
   ck_free(afl->fsrv.out_file);