diff options
author | hexcoder- <heiko@hexco.de> | 2020-11-14 12:36:28 +0100 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2020-11-14 12:36:28 +0100 |
commit | e750a5c856486bb89401f3555ca529bf743146f4 (patch) | |
tree | bdce419c4302e3fddbacaa07f9df6b874cfaa229 /src | |
parent | 30cd8a8397419b3eedb6ee939e290b4c6b8c2cf1 (diff) | |
download | afl++-e750a5c856486bb89401f3555ca529bf743146f4.tar.gz |
add sanity check for -M/-S arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-fuzz.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index f662b308..6b19d648 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -435,8 +435,12 @@ int main(int argc, char **argv_orig, char **envp) { u8 *c; - if (afl->non_instrumented_mode) { FATAL("-M is not supported in non-instrumented mode "); } + if (afl->non_instrumented_mode) { FATAL("-M is not supported in non-instrumented mode"); } if (afl->sync_id) { FATAL("Multiple -S or -M options not supported"); } + + /* sanity check for argument: should not begin with '-' (possible option) */ + if (optarg && *optarg == '-') { FATAL("argument for -M started with a dash '-', which is used for options"); } + afl->sync_id = ck_strdup(optarg); afl->skip_deterministic = 0; // force determinsitic fuzzing afl->old_seed_selection = 1; // force old queue walking seed selection @@ -465,8 +469,12 @@ int main(int argc, char **argv_orig, char **envp) { case 'S': /* secondary sync id */ - if (afl->non_instrumented_mode) { FATAL("-S is not supported in non-instrumented mode "); } + if (afl->non_instrumented_mode) { FATAL("-S is not supported in non-instrumented mode"); } if (afl->sync_id) { FATAL("Multiple -S or -M options not supported"); } + + /* sanity check for argument: should not begin with '-' (possible option) */ + if (optarg && *optarg == '-') { FATAL("argument for -M started with a dash '-', which is used for options"); } + afl->sync_id = ck_strdup(optarg); afl->is_secondary_node = 1; break; |