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/similarity-tester-3.0.2/add_run.c Examining data/similarity-tester-3.0.2/hash.h Examining data/similarity-tester-3.0.2/any_int.h Examining data/similarity-tester-3.0.2/compare.h Examining data/similarity-tester-3.0.2/lex.h Examining data/similarity-tester-3.0.2/newargs.c Examining data/similarity-tester-3.0.2/token.c Examining data/similarity-tester-3.0.2/properties.h Examining data/similarity-tester-3.0.2/lang.c Examining data/similarity-tester-3.0.2/sim.c Examining data/similarity-tester-3.0.2/hash.c Examining data/similarity-tester-3.0.2/sim.h Examining data/similarity-tester-3.0.2/lex.c Examining data/similarity-tester-3.0.2/stream.c Examining data/similarity-tester-3.0.2/text.c Examining data/similarity-tester-3.0.2/runs.h Examining data/similarity-tester-3.0.2/lang.h Examining data/similarity-tester-3.0.2/any_int.c Examining data/similarity-tester-3.0.2/Malloc.c Examining data/similarity-tester-3.0.2/tokenarray.h Examining data/similarity-tester-3.0.2/idf.h Examining data/similarity-tester-3.0.2/idf.c Examining data/similarity-tester-3.0.2/ForEachFile.h Examining data/similarity-tester-3.0.2/token.h Examining data/similarity-tester-3.0.2/debug.h Examining data/similarity-tester-3.0.2/percentages.c Examining data/similarity-tester-3.0.2/properties.c Examining data/similarity-tester-3.0.2/pass2.h Examining data/similarity-tester-3.0.2/add_run.h Examining data/similarity-tester-3.0.2/percentages.h Examining data/similarity-tester-3.0.2/tokenarray.c Examining data/similarity-tester-3.0.2/Malloc.h Examining data/similarity-tester-3.0.2/options.h Examining data/similarity-tester-3.0.2/options.c Examining data/similarity-tester-3.0.2/fname.h Examining data/similarity-tester-3.0.2/utf8.h Examining data/similarity-tester-3.0.2/pass2.c Examining data/similarity-tester-3.0.2/pass3.h Examining data/similarity-tester-3.0.2/runs.c Examining data/similarity-tester-3.0.2/utf8.c Examining data/similarity-tester-3.0.2/pass1.c Examining data/similarity-tester-3.0.2/newargs.h Examining data/similarity-tester-3.0.2/stream.h Examining data/similarity-tester-3.0.2/debug.c Examining data/similarity-tester-3.0.2/compare.c Examining data/similarity-tester-3.0.2/text.h Examining data/similarity-tester-3.0.2/pass3.c Examining data/similarity-tester-3.0.2/pass1.h Examining data/similarity-tester-3.0.2/fname.c Examining data/similarity-tester-3.0.2/ForEachFile.c FINAL RESULTS: data/similarity-tester-3.0.2/Malloc.c:38:8: [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. #undef printf data/similarity-tester-3.0.2/Malloc.c:39:9: [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. #define printf use_fprintf data/similarity-tester-3.0.2/Malloc.c:281:9: [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((char *)(_mreg_malloc(chk, strlen(s)+1, fname, l_nmb)), data/similarity-tester-3.0.2/fname.h:84:18: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. #define Fnamecpy wcscpy data/similarity-tester-3.0.2/fname.h:85:18: [4] (buffer) wcscat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). #define Fnamecat wcscat data/similarity-tester-3.0.2/fname.h:106:18: [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). #define Fnamecpy strcpy data/similarity-tester-3.0.2/fname.h:107:18: [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). #define Fnamecat strcat data/similarity-tester-3.0.2/options.c:152:2: [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. fprintf(stderr, msg, c); data/similarity-tester-3.0.2/sim.c:124:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(version, "Version %s", VERSION); data/similarity-tester-3.0.2/sim.c:126:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(version, "Build %s, %s", __DATE__, __TIME__); data/similarity-tester-3.0.2/sim.c:190:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg, "cannot open output file `%s'", data/similarity-tester-3.0.2/sim.h:24:8: [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. #undef printf data/similarity-tester-3.0.2/sim.h:25:9: [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. #define printf use_fprintf data/similarity-tester-3.0.2/any_int.c:25: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 buff[N_INDEPENDENT_CALLS][MAX_ANY_UINT_DIGITS+1]; data/similarity-tester-3.0.2/fname.h:121:16: [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). #define Fopen fopen data/similarity-tester-3.0.2/options.c:14: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 options[128]; data/similarity-tester-3.0.2/options.c:119:26: [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). *(int *)op->op_value = atoi(string); data/similarity-tester-3.0.2/options.c:136: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 msg[256]; data/similarity-tester-3.0.2/options.c:137:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(msg, data/similarity-tester-3.0.2/pass3.c:148:7: [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). f = fopen(NULLFILE, "r"); data/similarity-tester-3.0.2/properties.c:15: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 non_finals[N_REGULAR_TOKENS]; data/similarity-tester-3.0.2/properties.c:16: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 non_initials[N_REGULAR_TOKENS]; data/similarity-tester-3.0.2/properties.c:17: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 openers[N_REGULAR_TOKENS]; data/similarity-tester-3.0.2/properties.c:18: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 closers[N_REGULAR_TOKENS]; data/similarity-tester-3.0.2/sim.c:122:2: [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 version[40]; data/similarity-tester-3.0.2/sim.c:186:17: [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). Output_File = fopen(output_name, "w"); data/similarity-tester-3.0.2/stream.c:40:10: [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(NULLFILE, "r"); data/similarity-tester-3.0.2/utf8.h:120:2: [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 text[8]; data/similarity-tester-3.0.2/Malloc.c:281:43: [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((char *)(_mreg_malloc(chk, strlen(s)+1, fname, l_nmb)), data/similarity-tester-3.0.2/fname.h:86:23: [1] (buffer) wcslen: 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 Fnamelen (int)wcslen data/similarity-tester-3.0.2/fname.h:108:18: [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 Fnamelen strlen data/similarity-tester-3.0.2/newargs.c:56:14: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (ch = getchar(), ch != EOF) { data/similarity-tester-3.0.2/pass3.c:154:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int ch = getc(f); data/similarity-tester-3.0.2/pass3.c:169:19: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). do { int byte = getc(f); data/similarity-tester-3.0.2/pass3.c:222:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(f)), ch > 0 && ch != '\n') { data/similarity-tester-3.0.2/sim.c:188:31: [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). char *msg = (char *)Malloc(strlen(output_name) + 100); data/similarity-tester-3.0.2/utf8.h:96:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(stdin)) != EOF) { ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 5198 in approximately 0.18 seconds (29347 lines/second) Physical Source Lines of Code (SLOC) = 3281 Hits@level = [0] 103 [1] 9 [2] 15 [3] 0 [4] 13 [5] 0 Hits@level+ = [0+] 140 [1+] 37 [2+] 28 [3+] 13 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 42.6699 [1+] 11.277 [2+] 8.53398 [3+] 3.96221 [4+] 3.96221 [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.