add sanity check for -M/-S arguments

This commit is contained in:
hexcoder-
2020-11-14 12:36:28 +01:00
parent 30cd8a8397
commit e750a5c856

View File

@ -435,8 +435,12 @@ int main(int argc, char **argv_orig, char **envp) {
u8 *c; 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"); } 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->sync_id = ck_strdup(optarg);
afl->skip_deterministic = 0; // force determinsitic fuzzing afl->skip_deterministic = 0; // force determinsitic fuzzing
afl->old_seed_selection = 1; // force old queue walking seed selection 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 */ 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"); } 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->sync_id = ck_strdup(optarg);
afl->is_secondary_node = 1; afl->is_secondary_node = 1;
break; break;