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/missidentify-1.0/check.c Examining data/missidentify-1.0/helpers.c Examining data/missidentify-1.0/main.h Examining data/missidentify-1.0/sample.c Examining data/missidentify-1.0/tchar-local.h Examining data/missidentify-1.0/ui.c Examining data/missidentify-1.0/main.c Examining data/missidentify-1.0/dig.c Examining data/missidentify-1.0/cycles.c FINAL RESULTS: data/missidentify-1.0/tchar-local.h:46:10: [4] (format) _sntprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define _sntprintf snprintf data/missidentify-1.0/tchar-local.h:46:21: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define _sntprintf snprintf data/missidentify-1.0/tchar-local.h:47:21: [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 _tprintf printf data/missidentify-1.0/tchar-local.h:48:10: [4] (format) _ftprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define _ftprintf fprintf data/missidentify-1.0/tchar-local.h:48: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 _ftprintf fprintf data/missidentify-1.0/ui.c:12:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt,ap); data/missidentify-1.0/ui.c:27:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt,ap); data/missidentify-1.0/ui.c:37:5: [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. if (vfprintf(HANDLE,MSG,ap) < 0) \ data/missidentify-1.0/ui.c:77:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt,ap); data/missidentify-1.0/cycles.c:55:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(fn,d_name); data/missidentify-1.0/cycles.c:111:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(fn,d_name); data/missidentify-1.0/cycles.c:162:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(fn,d_name); data/missidentify-1.0/main.c:43:13: [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 ((i=getopt(argc,argv,"rqas:S:lbvhV")) != -1) { data/missidentify-1.0/main.c:166:2: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(input,fn); data/missidentify-1.0/main.h:88:9: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. #define realpath(A,B) _fullpath(B,A,PATH_MAX) data/missidentify-1.0/dig.c:28:3: [2] (buffer) TCHAR: 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. TCHAR DOUBLE_DIR[4], *tmp = fn, *new; data/missidentify-1.0/main.c:59:23: [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). len = (uint16_t)atol(optarg); data/missidentify-1.0/main.h:153:22: [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. /* 000 */ unsigned char Name[8]; data/missidentify-1.0/tchar-local.h:55:21: [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 _tfopen fopen data/missidentify-1.0/check.c:194:28: [1] (buffer) _tcslen: 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). s->file_extension = fn + _tcslen(fn) - 1; data/missidentify-1.0/dig.c:45:31: [1] (buffer) _tcslen: 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). _tmemmove(new,new+tsize,_tcslen(new)); data/missidentify-1.0/dig.c:60:15: [1] (buffer) _tcslen: 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 sz = _tcslen(fn), tsize = sizeof(TCHAR); data/missidentify-1.0/dig.c:90:30: [1] (buffer) _tcslen: 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 pos, next_dir, sz = _tcslen(fn), tsize = sizeof(TCHAR); data/missidentify-1.0/dig.c:92:23: [1] (buffer) _tcslen: 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). for (pos = 0; pos < _tcslen(fn) ; pos++) data/missidentify-1.0/dig.c:164:19: [1] (buffer) _tcslen: 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 length = _tcslen(fn); data/missidentify-1.0/dig.c:193:8: [1] (buffer) _tcslen: 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). (_tcslen(fn) == 18) && data/missidentify-1.0/dig.c:198:8: [1] (buffer) _tcslen: 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). (_tcslen(fn) == 9) && data/missidentify-1.0/dig.c:203:8: [1] (buffer) _tcslen: 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). (_tcslen(fn) == 6) && data/missidentify-1.0/dig.c:243:42: [1] (buffer) _tcslen: 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 ((!_tcsncmp(d,_TEXT("."),1) && (_tcslen(d) == 1)) || data/missidentify-1.0/dig.c:244:43: [1] (buffer) _tcslen: 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). (!_tcsncmp(d,_TEXT(".."),2) && (_tcslen(d) == 2))); data/missidentify-1.0/helpers.c:46:7: [1] (buffer) _tcslen: 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 (_tcslen(src) < MAX_FILENAME_LENGTH) data/missidentify-1.0/helpers.c:48:7: [1] (buffer) _tcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). _tcsncpy(dest,src, MAX_FILENAME_LENGTH); data/missidentify-1.0/helpers.c:58:7: [1] (buffer) _tcslen: 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 (_tcslen(basen) < MAX_FILENAME_LENGTH) data/missidentify-1.0/helpers.c:60:7: [1] (buffer) _tcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). _tcsncpy(dest,basen,MAX_FILENAME_LENGTH); data/missidentify-1.0/helpers.c:78:15: [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 (start > strlen(fn) || new_start < start) data/missidentify-1.0/helpers.c:81: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). while (new_start < strlen(fn)) data/missidentify-1.0/helpers.c:96:15: [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 size=strlen(s); data/missidentify-1.0/helpers.c:142:11: [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). end = strlen(s); data/missidentify-1.0/helpers.c:172:9: [1] (buffer) _tcslen: 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). len = _tcslen(tmp); data/missidentify-1.0/main.c:153:5: [1] (buffer) _tcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). _tcsncpy(fn,input,PATH_MAX); data/missidentify-1.0/main.h:106:56: [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 MIN_STRINGS_EQUAL(A,B) (!strncasecmp(A,B,MIN(strlen(A),strlen(B)))) data/missidentify-1.0/main.h:106:66: [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 MIN_STRINGS_EQUAL(A,B) (!strncasecmp(A,B,MIN(strlen(A),strlen(B)))) data/missidentify-1.0/main.h:107:56: [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 STRINGS_EQUAL(A,B) (!strncasecmp(A,B,MAX(strlen(A),strlen(B)))) data/missidentify-1.0/main.h:107:66: [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 STRINGS_EQUAL(A,B) (!strncasecmp(A,B,MAX(strlen(A),strlen(B)))) data/missidentify-1.0/tchar-local.h:62:10: [1] (buffer) _tcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define _tcsncpy strncpy data/missidentify-1.0/tchar-local.h:62:21: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define _tcsncpy strncpy data/missidentify-1.0/tchar-local.h:63:10: [1] (buffer) _tcslen: 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 _tcslen strlen data/missidentify-1.0/tchar-local.h:63: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 _tcslen strlen data/missidentify-1.0/ui.c:93:9: [1] (buffer) _tcslen: 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). len = _tcslen(fn); ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 1960 in approximately 0.06 seconds (35444 lines/second) Physical Source Lines of Code (SLOC) = 1255 Hits@level = [0] 25 [1] 30 [2] 4 [3] 6 [4] 9 [5] 0 Hits@level+ = [0+] 74 [1+] 49 [2+] 19 [3+] 15 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 58.9641 [1+] 39.0438 [2+] 15.1394 [3+] 11.9522 [4+] 7.17131 [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.