add sanity check for -M/-S arguments
@@ -437,6 +437,10 @@ int main(int argc, char **argv_orig, char **envp) {
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
@@ -467,6 +471,10 @@ int main(int argc, char **argv_orig, char **envp) {
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;
