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/simhash-0.0.20161225/crc.h Examining data/simhash-0.0.20161225/simhash.c Examining data/simhash-0.0.20161225/crc32.c Examining data/simhash-0.0.20161225/heap.h Examining data/simhash-0.0.20161225/hash.c Examining data/simhash-0.0.20161225/hash.h Examining data/simhash-0.0.20161225/heap.c FINAL RESULTS: data/simhash-0.0.20161225/simhash.c:206:2: [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(nambuf, SUFFIX); data/simhash-0.0.20161225/simhash.c:443:9: [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. switch(getopt_long(argc, argv, "wmcs:f:d", data/simhash-0.0.20161225/simhash.c:170: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). FILE *f = fopen(filename, "r"); data/simhash-0.0.20161225/simhash.c:195:12: [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 nambuf[MAXPATHLEN + 1]; data/simhash-0.0.20161225/simhash.c:207: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). of = fopen(nambuf, "w"); data/simhash-0.0.20161225/simhash.c:265: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). FILE *f = fopen(name, "r"); data/simhash-0.0.20161225/simhash.c:455:17: [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). nshingle = atoi(optarg); data/simhash-0.0.20161225/simhash.c:463:17: [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). nfeature = atoi(optarg); data/simhash-0.0.20161225/simhash.c:112:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int ch = fgetc(f); data/simhash-0.0.20161225/simhash.c:123:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(f); data/simhash-0.0.20161225/simhash.c:203:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(nambuf, argv[i], data/simhash-0.0.20161225/simhash.c:394: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). int n = strlen(argv[i]); data/simhash-0.0.20161225/simhash.c:414: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). for (j = strlen(argv[i]); j <= nfilename; j++) ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 910 in approximately 0.04 seconds (25238 lines/second) Physical Source Lines of Code (SLOC) = 684 Hits@level = [0] 35 [1] 5 [2] 6 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 48 [1+] 13 [2+] 8 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 70.1754 [1+] 19.0058 [2+] 11.6959 [3+] 2.92398 [4+] 1.46199 [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.