diff options
author | Dominik Maier <domenukk@gmail.com> | 2020-12-03 14:43:06 +0100 |
---|---|---|
committer | Dominik Maier <domenukk@gmail.com> | 2020-12-03 14:43:06 +0100 |
commit | a2e2fae840e9946c7994ac6807bed8496d71af56 (patch) | |
tree | c4162219bb50b7d46ef15120c13841a4b10d873c /src/afl-showmap.c | |
parent | 0f803c63dfb1dafdef3bfe1b43674157efcd7107 (diff) | |
download | afl++-a2e2fae840e9946c7994ac6807bed8496d71af56.tar.gz |
AFL_CRASH_EXITCODE env var added, u8->bool
Diffstat (limited to 'src/afl-showmap.c')
-rw-r--r-- | src/afl-showmap.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c index a8e7d3f9..e07e76c8 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -667,6 +667,8 @@ static void usage(u8 *argv0) { "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" + "AFL_CRASH_EXITCODE: optional child exit code to be interpreted as " + "crash\n" "AFL_DEBUG: enable extra developer output\n" "AFL_MAP_SIZE: the shared memory size for that target. must be >= the " "size\n" @@ -1090,6 +1092,23 @@ int main(int argc, char **argv_orig, char **envp) { } + if (getenv("AFL_CRASH_EXITCODE")) { + + long exitcode = strtol(getenv("AFL_CRASH_EXITCODE"), NULL, 10); + if ((!exitcode && (errno == EINVAL || errno == ERANGE)) || + exitcode < -127 || exitcode > 128) { + + FATAL("Invalid crash exitcode, expected -127 to 128, but got %s", + getenv("AFL_CRASH_EXITCODE")); + + } + + fsrv->uses_crash_exitcode = true; + // WEXITSTATUS is 8 bit unsigned + fsrv->crash_exitcode = (u8)exitcode; + + } + afl_fsrv_start(fsrv, use_argv, &stop_soon, (get_afl_env("AFL_DEBUG_CHILD") || get_afl_env("AFL_DEBUG_CHILD_OUTPUT")) |