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/unsort-1.2.1/mt19937ar_init.c Examining data/unsort-1.2.1/lsort.h Examining data/unsort-1.2.1/unfind.h Examining data/unsort-1.2.1/shuffle.h Examining data/unsort-1.2.1/iovec.h Examining data/unsort-1.2.1/merge.h Examining data/unsort-1.2.1/filebuf.h Examining data/unsort-1.2.1/msort.h Examining data/unsort-1.2.1/mt19937ar.c Examining data/unsort-1.2.1/error.c Examining data/unsort-1.2.1/merge.c Examining data/unsort-1.2.1/filebuf.c Examining data/unsort-1.2.1/msort.c Examining data/unsort-1.2.1/unfind.c Examining data/unsort-1.2.1/shuffle.c Examining data/unsort-1.2.1/iovec.c Examining data/unsort-1.2.1/mt19937ar_init.h Examining data/unsort-1.2.1/lsort.c Examining data/unsort-1.2.1/error.h Examining data/unsort-1.2.1/unsort.c Examining data/unsort-1.2.1/mt19937ar.h FINAL RESULTS: data/unsort-1.2.1/error.c:36:3: [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. vfprintf(stderr, msg, ap); data/unsort-1.2.1/error.c:49:3: [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. vfprintf(stderr, msg, ap); data/unsort-1.2.1/error.c:60:3: [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. vfprintf(stderr, msg, ap); data/unsort-1.2.1/error.c:73:3: [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. vfprintf(stderr, msg, ap); data/unsort-1.2.1/unsort.c:139:13: [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((i = getopt_long(argc, argv, short_options, long_options, &option_index)) != EOF) { data/unsort-1.2.1/unsort.c:333:5: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if(getenv("UNSORT_FSCK")) data/unsort-1.2.1/filebuf.c:41:7: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fh = tmpfile(); data/unsort-1.2.1/mt19937ar_init.c:39:7: [2] (misc) open: 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). fd = open("/dev/urandom", O_RDONLY); data/unsort-1.2.1/shuffle.c:85:4: [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(dst, src, count * sizeof *src); data/unsort-1.2.1/shuffle.c:99:4: [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(dst, src, count * sizeof *src); data/unsort-1.2.1/unfind.c:178:4: [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(tlb + start, bounce + start, count * sizeof *tlb); data/unsort-1.2.1/unfind.c:196: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(tlb + start, bounce, chunk_count * sizeof *tlb); data/unsort-1.2.1/unsort.c:90:2: [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(tmp, tlb, count * sizeof *tmp); data/unsort-1.2.1/unsort.c:118: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 short_options[32]; data/unsort-1.2.1/unsort.c:249:10: [2] (misc) open: 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). fd = open(argv[i], O_RDONLY | O_LARGEFILE); data/unsort-1.2.1/filebuf.c:94:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, filebuf_off(buf, len), left); data/unsort-1.2.1/filebuf.c:133:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, (char *)buf + len - offset, left); data/unsort-1.2.1/mt19937ar_init.c:45:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, buf + len, sizeof buf - len); data/unsort-1.2.1/unfind.c:52: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). unfind_stategy_len = strlen(unfind_strategy); data/unsort-1.2.1/unfind.c:263: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). vecjes[u].iov_len = strlen(str[u]); data/unsort-1.2.1/unsort.c:82:27: [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). long_options[i].name + strlen(long_options[i].name) + 1); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 2202 in approximately 0.09 seconds (24446 lines/second) Physical Source Lines of Code (SLOC) = 1401 Hits@level = [0] 6 [1] 6 [2] 9 [3] 2 [4] 4 [5] 0 Hits@level+ = [0+] 27 [1+] 21 [2+] 15 [3+] 6 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 19.2719 [1+] 14.9893 [2+] 10.7066 [3+] 4.28266 [4+] 2.8551 [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.