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/princeprocessor-0.22/src/mpz_int128.h Examining data/princeprocessor-0.22/src/pp.c FINAL RESULTS: data/princeprocessor-0.22/src/pp.c:272:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (USAGE_MINI[i], progname); data/princeprocessor-0.22/src/pp.c:295:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (USAGE_BIG[i], progname); data/princeprocessor-0.22/src/pp.c:749:15: [3] (buffer) getopt_long: 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_long (argc, argv, "Vhs:l:o:c", long_options, &option_index)) != -1) data/princeprocessor-0.22/src/pp.c:122:3: [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 buf[BUFSIZ]; data/princeprocessor-0.22/src/pp.c:409:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (out->buf + out->len, pw_buf, pw_len); data/princeprocessor-0.22/src/pp.c:527:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (pw_buf, db_entry->elems_buf[elems_idx].buf, db_key); data/princeprocessor-0.22/src/pp.c:553:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (pw_buf, db_entry->elems_buf[elems_idx].buf, db_key); data/princeprocessor-0.22/src/pp.c:560:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (pw_buf, db_entry->elems_buf[0].buf, db_key); data/princeprocessor-0.22/src/pp.c:601:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (elem_buf->buf, input_buf, input_len); data/princeprocessor-0.22/src/pp.c:667:14: [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 *fp = fopen (SAVE_FILE, "w"); data/princeprocessor-0.22/src/pp.c:756:59: [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). case IDX_PW_MIN: pw_min = atoi (optarg); break; data/princeprocessor-0.22/src/pp.c:757:59: [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). case IDX_PW_MAX: pw_max = atoi (optarg); break; data/princeprocessor-0.22/src/pp.c:758:59: [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). case IDX_ELEM_CNT_MIN: elem_cnt_min = atoi (optarg); break; data/princeprocessor-0.22/src/pp.c:759:59: [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). case IDX_ELEM_CNT_MAX: elem_cnt_max = atoi (optarg); data/princeprocessor-0.22/src/pp.c:762:59: [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). case IDX_WL_MAX: wl_max = atoi (optarg); break; data/princeprocessor-0.22/src/pp.c:922: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). out->fp = fopen (output_file, "ab"); data/princeprocessor-0.22/src/pp.c:949: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). read_fp = fopen (wordlist, "rb"); data/princeprocessor-0.22/src/pp.c:963:5: [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 buf[BUFSIZ]; data/princeprocessor-0.22/src/pp.c:1106:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (chain_buf, &chain_buf_new, sizeof (chain_t)); data/princeprocessor-0.22/src/pp.c:1110:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (chain_buf->buf, chain_buf_new.buf, pw_len); data/princeprocessor-0.22/src/pp.c:1389:7: [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 pw_buf[BUFSIZ]; data/princeprocessor-0.22/src/mpz_int128.h:89:4: [1] (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). Risk is low because the source is a constant character. strcpy(ptr, "0"); \ data/princeprocessor-0.22/src/pp.c:360:13: [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). int len = strlen (buf); ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 1714 in approximately 0.06 seconds (26975 lines/second) Physical Source Lines of Code (SLOC) = 1193 Hits@level = [0] 24 [1] 2 [2] 18 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 47 [1+] 23 [2+] 21 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 39.3965 [1+] 19.2791 [2+] 17.6027 [3+] 2.51467 [4+] 1.67645 [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.