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/maskprocessor-0.73+git20170609.1708898/src/mp.c FINAL RESULTS: data/maskprocessor-0.73+git20170609.1708898/src/mp.c:115: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/maskprocessor-0.73+git20170609.1708898/src/mp.c:138: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/maskprocessor-0.73+git20170609.1708898/src/mp.c:224:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). case 'l': strcat (out_buf, mp_sys[0]); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:226:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). case 'u': strcat (out_buf, mp_sys[1]); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:228:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). case 'd': strcat (out_buf, mp_sys[2]); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:230:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). case 's': strcat (out_buf, mp_sys[3]); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:232:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). case 'a': strcat (out_buf, mp_sys[4]); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:269:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (out_buf, s); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:275:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (out_buf, s); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:392: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, "Vhi:q:s:l:o:1:2:3:4:r:", long_options, &option_index)) != -1) data/maskprocessor-0.73+git20170609.1708898/src/mp.c:34: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 cs_buf[CHARSIZ]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:35: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 cs_uniq[CHARSIZ]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:44: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[OUTBUFSZ + SPARE]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:208:32: [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 size_t mp_expand (const char *in_buf, const size_t in_len, char *out_buf, char *mp_sys[6], int hex_charset) data/maskprocessor-0.73+git20170609.1708898/src/mp.c:208:67: [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 size_t mp_expand (const char *in_buf, const size_t in_len, char *out_buf, char *mp_sys[6], int hex_charset) data/maskprocessor-0.73+git20170609.1708898/src/mp.c:208:82: [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 size_t mp_expand (const char *in_buf, const size_t in_len, char *out_buf, char *mp_sys[6], int hex_charset) data/maskprocessor-0.73+git20170609.1708898/src/mp.c:234:19: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case 'b': memcpy (out_buf, mp_sys[5], 256); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:264:9: [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 s[2] = { 0, 0 }; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:273:9: [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 s[2] = { p0, 0 }; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:400:55: [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_SEQ_MAX: seq_max = atoi (optarg); break; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:401:55: [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_OCCUR_MAX: occur_max = atoi (optarg); break; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:509: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 *mp_sys[6]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:518: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 *mp_user[4]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:527: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 donec[CHARSIZ]; memset (donec, 0, CHARSIZ); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:564:19: [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 ((fp_out = fopen (output_file, "ab")) == NULL) data/maskprocessor-0.73+git20170609.1708898/src/mp.c:615:19: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case 'b': memcpy (css[css_cnt].cs_buf, mp_sys[5], 256); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:662:9: [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 s[2] = { 0, 0 }; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:671:9: [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 s[2] = { p0, 0 }; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:760:21: [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). increment_min = atoi (s_min); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:761:21: [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). increment_max = atoi (s_max); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:812: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 word_buf[PW_MAX]; data/maskprocessor-0.73+git20170609.1708898/src/mp.c:852: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 (out->buf + out->pos, word_buf, word_len); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:931: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 (out->buf + out->pos, word_buf, word_len); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:171:22: [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). size_t input_len = strlen (input_buf); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:236:19: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. case '?': strcat (out_buf, "?"); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:280:10: [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 strlen (out_buf); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:548:54: [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). if (custom_charset_1) mp_expand (custom_charset_1, strlen (custom_charset_1), mp_user[0], mp_sys, hex_charset); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:549:54: [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). if (custom_charset_2) mp_expand (custom_charset_2, strlen (custom_charset_2), mp_user[1], mp_sys, hex_charset); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:550:54: [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). if (custom_charset_3) mp_expand (custom_charset_3, strlen (custom_charset_3), mp_user[2], mp_sys, hex_charset); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:551:54: [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). if (custom_charset_4) mp_expand (custom_charset_4, strlen (custom_charset_4), mp_user[3], mp_sys, hex_charset); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:578: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). size_t line_len = strlen (line_buf); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:684:24: [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 start_at_len = strlen (start_at); data/maskprocessor-0.73+git20170609.1708898/src/mp.c:712:23: [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 stop_at_len = strlen (stop_at); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 963 in approximately 0.03 seconds (29761 lines/second) Physical Source Lines of Code (SLOC) = 723 Hits@level = [0] 27 [1] 10 [2] 23 [3] 1 [4] 9 [5] 0 Hits@level+ = [0+] 70 [1+] 43 [2+] 33 [3+] 10 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 96.8188 [1+] 59.4744 [2+] 45.6432 [3+] 13.8313 [4+] 12.4481 [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.