Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/buddy-2.4/src/bdd.h Examining data/buddy-2.4/src/fdd.h Examining data/buddy-2.4/src/bvec.h Examining data/buddy-2.4/src/bddio.c Examining data/buddy-2.4/src/bddop.c Examining data/buddy-2.4/src/bddtree.h Examining data/buddy-2.4/src/bvec.c Examining data/buddy-2.4/src/cache.c Examining data/buddy-2.4/src/cache.h Examining data/buddy-2.4/src/cppext.cxx Examining data/buddy-2.4/src/fdd.c Examining data/buddy-2.4/src/imatrix.c Examining data/buddy-2.4/src/imatrix.h Examining data/buddy-2.4/src/kernel.c Examining data/buddy-2.4/src/kernel.h Examining data/buddy-2.4/src/pairs.c Examining data/buddy-2.4/src/prime.c Examining data/buddy-2.4/src/prime.h Examining data/buddy-2.4/src/reorder.c Examining data/buddy-2.4/src/tree.c Examining data/buddy-2.4/src/bddtest.cxx Examining data/buddy-2.4/examples/adder/adder.cxx Examining data/buddy-2.4/examples/bddcalc/lexer.cxx Examining data/buddy-2.4/examples/bddcalc/parser.cxx Examining data/buddy-2.4/examples/bddcalc/parser.h Examining data/buddy-2.4/examples/bddcalc/hashtbl.h Examining data/buddy-2.4/examples/bddcalc/hashtbl.cxx Examining data/buddy-2.4/examples/bddcalc/parser_.h Examining data/buddy-2.4/examples/bddcalc/slist.h Examining data/buddy-2.4/examples/bddtest/bddtest.cxx Examining data/buddy-2.4/examples/cmilner/cmilner.c Examining data/buddy-2.4/examples/fdd/fdd.cxx Examining data/buddy-2.4/examples/milner/milner.cxx Examining data/buddy-2.4/examples/money/money.cxx Examining data/buddy-2.4/examples/queen/queen.cxx Examining data/buddy-2.4/examples/solitare/solitare.cxx FINAL RESULTS: data/buddy-2.4/examples/bddcalc/parser.cxx:628:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define YYFPRINTF fprintf data/buddy-2.4/examples/bddcalc/parser.cxx:1584:4: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, argp); data/buddy-2.4/examples/bddcalc/parser_.h:39:11: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). return strcpy(new char[strlen(s)+1], s); data/buddy-2.4/examples/solitare/solitare.cxx:214:4: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system("ps aux | grep \"./solitare\" | grep -v \"grep\""); data/buddy-2.4/examples/bddcalc/parser.cxx:1545:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c=getopt(ac, av, "hg")) != EOF) data/buddy-2.4/src/prime.c:302:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(NULL)); data/buddy-2.4/src/reorder.c:126:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. #define random(a) (rand() % (a)) data/buddy-2.4/src/reorder.c:720:17: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int blk = random(num); data/buddy-2.4/examples/adder/adder.cxx:60:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). N = atoi(argv[1]); data/buddy-2.4/examples/bddcalc/lexer.cxx:919:17: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). { yylval.ival = atol(yytext); return T_intval; } data/buddy-2.4/examples/bddcalc/parser.cxx:1561:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). yyin = fopen(av[optind],"r"); data/buddy-2.4/examples/bddcalc/parser_.h:18:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char id[MAXIDLEN+1]; data/buddy-2.4/examples/cmilner/cmilner.c:239:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). N = atoi(argv[1]); data/buddy-2.4/examples/milner/milner.cxx:107:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). N = atoi(argv[1]); data/buddy-2.4/examples/queen/queen.cxx:86:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). N = atoi(av[1]); data/buddy-2.4/src/bddio.c:320:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *ofile = fopen(fname, "w"); data/buddy-2.4/src/bddio.c:386:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((ofile=fopen(fname,"w")) == NULL) data/buddy-2.4/src/bddio.c:480:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((ifile=fopen(fname,"r")) == NULL) data/buddy-2.4/src/kernel.c:121:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char *errorstrings[BDD_ERRNUM] = data/buddy-2.4/examples/bddcalc/lexer.cxx:568:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/buddy-2.4/examples/bddcalc/lexer.cxx:914:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). { strncpy(yylval.id, yytext, MAXIDLEN); return T_id; } data/buddy-2.4/examples/bddcalc/lexer.cxx:926:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). yylval.str[strlen(yylval.str)-1]=0; return T_str; } data/buddy-2.4/examples/bddcalc/parser.cxx:749:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). # define yystrlen strlen data/buddy-2.4/examples/bddcalc/parser_.h:39:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return strcpy(new char[strlen(s)+1], s); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 18906 in approximately 0.51 seconds (37019 lines/second) Physical Source Lines of Code (SLOC) = 11384 Hits@level = [0] 152 [1] 5 [2] 11 [3] 4 [4] 4 [5] 0 Hits@level+ = [0+] 176 [1+] 24 [2+] 19 [3+] 8 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 15.4603 [1+] 2.10822 [2+] 1.66901 [3+] 0.702741 [4+] 0.35137 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.