xref: /aosp_15_r20/external/AFLplusplus/utils/argv_fuzzing/argv_fuzz_demo.c (revision 08b48e0b10e97b33e7b60c5b6e2243bd915777f2)
1 #include <stdio.h>
2 #include <string.h>
3 #include "argv-fuzz-inl.h"
4 
main(int argc,char ** argv)5 int main(int argc, char **argv) {
6 
7   // Initialize the argv array for use with the AFL (American Fuzzy Lop) tool
8   AFL_INIT_ARGV();
9 
10   /* Check the number of command line arguments and
11     compare the values of the first two arguments to specific strings.
12     If the number of arguments is not correct or the values do not match,
13     an error message is printed. If the values do match, the program
14     calls the abort() function. */
15   if (argc > 1 && strcmp(argv[1], "XYZ") == 0) {
16 
17     if (strcmp(argv[2], "TEST2") == 0) { abort(); }
18 
19   } else {
20 
21     printf("Bad number of arguments!\n");
22 
23   }
24 
25   return 0;
26 
27 }
28 
29