about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormarc <marc@marc.srlabs.de>2023-08-09 16:28:04 +0200
committermarc <marc@marc.srlabs.de>2023-08-09 16:28:04 +0200
commit5618062cb55f1ac094e33ad662a03df45e048f45 (patch)
tree0f5942b7226b5f1bd3b5c62c96c45bfa7683b634 /src
parent7f17a94349830a54d2c899f56b149c0d7f9ffb9c (diff)
downloadafl++-5618062cb55f1ac094e33ad662a03df45e048f45.tar.gz
-c - support
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 9afece66..e0e54b49 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -180,7 +180,8 @@ static void usage(u8 *argv0, int more_help) {
       "it.\n"
       "                  if using QEMU/FRIDA or the fuzzing target is "
       "compiled\n"
-      "                  for CmpLog then just use -c 0.\n"
+      "                  for CmpLog then use '-c 0'. To disable Cmplog use '-c "
+      "-'.\n"
       "  -l cmplog_opts - CmpLog configuration values (e.g. \"2ATR\"):\n"
       "                  1=small files, 2=larger files (default), 3=all "
       "files,\n"
@@ -594,8 +595,23 @@ int main(int argc, char **argv_orig, char **envp) {
 
       case 'c': {
 
-        afl->shm.cmplog_mode = 1;
-        afl->cmplog_binary = ck_strdup(optarg);
+        if (strcmp(optarg, "-") == 0) {
+
+          if (afl->shm.cmplog_mode) {
+
+            ACTF("Disabling cmplog again because of '-c -'.");
+            afl->shm.cmplog_mode = 0;
+            afl->cmplog_binary = NULL;
+
+          }
+
+        } else {
+
+          afl->shm.cmplog_mode = 1;
+          afl->cmplog_binary = ck_strdup(optarg);
+
+        }
+
         break;
 
       }
@@ -1500,8 +1516,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   if (!afl->use_banner) { afl->use_banner = argv[optind]; }
 
-  if (afl->shm.cmplog_mode &&
-      (!strcmp("-", afl->cmplog_binary) || !strcmp("0", afl->cmplog_binary))) {
+  if (afl->shm.cmplog_mode && strcmp("0", afl->cmplog_binary) == 0) {
 
     afl->cmplog_binary = strdup(argv[optind]);