about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-02-29 14:23:44 +0100
committervan Hauser <vh@thc.org>2020-02-29 14:23:44 +0100
commit6730b6a15ad102ee988614202147bf606e1b7fd5 (patch)
tree8b74c9f22b1a51270f34a209f69013b8762c320a /src
parent6e08be1d0b77bf51db8f847b65754727855e444e (diff)
downloadafl++-6730b6a15ad102ee988614202147bf606e1b7fd5.tar.gz
code-format, env.md fixes and adding -hh for env usage display into afl-fuzz and Makefile
Diffstat (limited to 'src')
-rw-r--r--src/afl-analyze.c6
-rw-r--r--src/afl-fuzz.c37
-rw-r--r--src/afl-showmap.c13
-rw-r--r--src/afl-tmin.c6
4 files changed, 39 insertions, 23 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index f566d3fe..bee78519 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -728,9 +728,11 @@ static void set_up_environment(void) {
       }
 
       if (qemu_preload)
-        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", qemu_preload, afl_preload, afl_preload);
+        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           qemu_preload, afl_preload, afl_preload);
       else
-        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", afl_preload, afl_preload);
+        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           afl_preload, afl_preload);
 
       setenv("QEMU_SET_ENV", buf, 1);
 
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 24491998..6b80e066 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -82,7 +82,7 @@ static u8* get_libradamsa_path(u8* own_loc) {
 
 /* Display usage hints. */
 
-static void usage(u8* argv0) {
+static void usage(u8* argv0, int more_help) {
 
   SAYF(
       "\n%s [ options ] -- /path/to/fuzzed_app [ ... ]\n\n"
@@ -143,8 +143,11 @@ static void usage(u8* argv0) {
       "file\n"
       "  -C            - crash exploration mode (the peruvian rabbit thing)\n"
       "  -e ext        - File extension for the temporarily generated test "
-      "case\n\n"
+      "case\n\n",
+      argv0, EXEC_TIMEOUT, MEM_LIMIT);
 
+  if (more_help > 1)
+    SAYF(
       "Environment variables used:\n"
       "AFL_PATH: path to AFL support binaries\n"
       "AFL_QUIET: suppress forkserver status messages\n"
@@ -179,11 +182,16 @@ static void usage(u8* argv0) {
       "MSAN_OPTIONS: custom settings for MSAN\n"
       "              (must contain exitcode="STRINGIFY(MSAN_ERROR)" and symbolize=0)\n"
       "AFL_SKIP_BIN_CHECK: skip the check, if the target is an excutable\n"
-      "AFL_PERSISTENT: not supported anymore -> no effect, just a warning\n"
-      "AFL_DEFER_FORKSRV: not supported anymore -> no effect, just a warning\n"
+      //"AFL_PERSISTENT: not supported anymore -> no effect, just a warning\n"
+      //"AFL_DEFER_FORKSRV: not supported anymore -> no effect, just a warning\n"
       "AFL_EXIT_WHEN_DONE: exit when all inputs are run and no new finds are found\n"
       "AFL_BENCH_UNTIL_CRASH: exit soon when the first crashing input has been found\n"
-      , argv0, EXEC_TIMEOUT, MEM_LIMIT);
+      "\n"
+    );
+  else
+    SAYF(
+        "To view also the supported environment variables of afl-fuzz please "
+        "use \"-hh\".\n\n");
 
 #ifdef USE_PYTHON
   SAYF("Compiled with %s module support, see docs/python_mutators.md\n",
@@ -217,7 +225,7 @@ int main(int argc, char** argv, char** envp) {
 
   s32    opt;
   u64    prev_queued = 0;
-  u32    sync_interval_cnt = 0, seek_to;
+  u32    sync_interval_cnt = 0, seek_to, show_help = 0;
   u8*    extras_dir = 0;
   u8     mem_limit_given = 0;
   u8     exit_1 = !!getenv("AFL_BENCH_JUST_ONE");
@@ -621,10 +629,7 @@ int main(int argc, char** argv, char** envp) {
 
       } break;
 
-      case 'h':
-        usage(argv[0]);
-        return -1;
-        break;  // not needed
+      case 'h': show_help++; break;  // not needed
 
       case 'R':
 
@@ -635,11 +640,13 @@ int main(int argc, char** argv, char** envp) {
 
         break;
 
-      default: usage(argv[0]);
+      default:
+        if (!show_help) show_help = 1;
 
     }
 
-  if (optind == argc || !in_dir || !out_dir) usage(argv[0]);
+  if (optind == argc || !in_dir || !out_dir || show_help)
+    usage(argv[0], show_help);
 
   OKF("afl++ is maintained by Marc \"van Hauser\" Heuse, Heiko \"hexcoder\" "
       "Eißfeldt and Andrea Fioraldi");
@@ -777,9 +784,11 @@ int main(int argc, char** argv, char** envp) {
       }
 
       if (qemu_preload)
-        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", qemu_preload, afl_preload, afl_preload);
+        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           qemu_preload, afl_preload, afl_preload);
       else
-        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", afl_preload, afl_preload);
+        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           afl_preload, afl_preload);
 
       setenv("QEMU_SET_ENV", buf, 1);
 
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 01e29d38..d6ac1e7d 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -560,9 +560,11 @@ static void set_up_environment(void) {
       }
 
       if (qemu_preload)
-        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", qemu_preload, afl_preload, afl_preload);
+        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           qemu_preload, afl_preload, afl_preload);
       else
-        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", afl_preload, afl_preload);
+        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           afl_preload, afl_preload);
 
       setenv("QEMU_SET_ENV", buf, 1);
 
@@ -652,10 +654,11 @@ static void usage(u8* argv0) {
       "Environment variables used:\n"
       "AFL_PRELOAD: LD_PRELOAD / DYLD_INSERT_LIBRARIES settings for target\n"
       "AFL_DEBUG: enable extra developer output\n"
-      "AFL_CMIN_CRASHES_ONLY: (cmin_mode) only write tuples for crashing inputs\n"
+      "AFL_CMIN_CRASHES_ONLY: (cmin_mode) only write tuples for crashing "
+      "inputs\n"
       "AFL_CMIN_ALLOW_ANY: (cmin_mode) write tuples for crashing inputs also\n"
-      "LD_BIND_LAZY: do not set LD_BIND_NOW env var for target\n"
-      , argv0, MEM_LIMIT, doc_path);
+      "LD_BIND_LAZY: do not set LD_BIND_NOW env var for target\n",
+      argv0, MEM_LIMIT, doc_path);
 
   exit(1);
 
diff --git a/src/afl-tmin.c b/src/afl-tmin.c
index 156dc8af..f6878903 100644
--- a/src/afl-tmin.c
+++ b/src/afl-tmin.c
@@ -903,9 +903,11 @@ static void set_up_environment(void) {
       }
 
       if (qemu_preload)
-        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", qemu_preload, afl_preload, afl_preload);
+        buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           qemu_preload, afl_preload, afl_preload);
       else
-        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", afl_preload, afl_preload);
+        buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s",
+                           afl_preload, afl_preload);
 
       setenv("QEMU_SET_ENV", buf, 1);