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/minimap-0.2/bseq.c Examining data/minimap-0.2/bseq.h Examining data/minimap-0.2/example.c Examining data/minimap-0.2/index.c Examining data/minimap-0.2/khash.h Examining data/minimap-0.2/kseq.h Examining data/minimap-0.2/ksort.h Examining data/minimap-0.2/kthread.c Examining data/minimap-0.2/kvec.h Examining data/minimap-0.2/main.c Examining data/minimap-0.2/map.c Examining data/minimap-0.2/minimap.h Examining data/minimap-0.2/misc.c Examining data/minimap-0.2/sdust.c Examining data/minimap-0.2/sdust.h Examining data/minimap-0.2/sketch.c Examining data/minimap-0.2/kdq.h FINAL RESULTS: data/minimap-0.2/main.c:36:14: [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 ((c = getopt(argc, argv, "w:k:B:b:t:r:c:f:Vv:NOg:I:d:lRPST:m:L:Dx:")) >= 0) { data/minimap-0.2/sdust.c:187:14: [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 ((c = getopt(argc, argv, "w:t:")) >= 0) { data/minimap-0.2/bseq.c:10:17: [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. extern unsigned char seq_nt4_table[256]; data/minimap-0.2/index.c:309: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 magic[4]; data/minimap-0.2/kseq.h:127: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(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \ data/minimap-0.2/kvec.h:74:3: [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((v1).a, (v0).a, sizeof(type) * (v0).n); \ data/minimap-0.2/main.c:37: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). if (c == 'w') w = atoi(optarg); data/minimap-0.2/main.c:38: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). else if (c == 'k') k = atoi(optarg); data/minimap-0.2/main.c:39: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). else if (c == 'b') b = atoi(optarg); data/minimap-0.2/main.c:40:35: [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). else if (c == 'r') opt.radius = atoi(optarg); data/minimap-0.2/main.c:41:36: [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). else if (c == 'c') opt.min_cnt = atoi(optarg); data/minimap-0.2/main.c:44:34: [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). else if (c == 't') n_threads = atoi(optarg); data/minimap-0.2/main.c:45:35: [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). else if (c == 'v') mm_verbose = atoi(optarg); data/minimap-0.2/main.c:46:36: [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). else if (c == 'g') opt.max_gap = atoi(optarg); data/minimap-0.2/main.c:55:40: [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). else if (c == 'T') opt.sdust_thres = atoi(optarg); data/minimap-0.2/main.c:56:38: [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). else if (c == 'L') opt.min_match = atoi(optarg); data/minimap-0.2/main.c:115:20: [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 (is_idx) fpr = fopen(argv[optind], "rb"); data/minimap-0.2/main.c:117: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). if (fnw) fpw = fopen(fnw, "wb"); data/minimap-0.2/map.c:312:3: [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(step->reg[i], regs, n_regs * sizeof(mm_reg1_t)); data/minimap-0.2/sdust.c:23:10: [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. unsigned char seq_nt4_table[256] = { data/minimap-0.2/sdust.c:42:17: [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. extern unsigned char seq_nt4_table[256]; data/minimap-0.2/sdust.c:108: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(c, cv, SD_WTOT * sizeof(int)); data/minimap-0.2/sdust.c:188: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). if (c == 'w') W = atoi(optarg); data/minimap-0.2/sdust.c:189: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). else if (c == 't') T = atoi(optarg); data/minimap-0.2/sketch.c:8:10: [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. unsigned char seq_nt4_table[256] = { data/minimap-0.2/index.c:205:13: [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). assert(strlen(s->seq[i].name) <= 254); data/minimap-0.2/index.c:283:8: [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). l = strlen(mi->name[i]); data/minimap-0.2/sdust.c:141:25: [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 (l_seq < 0) l_seq = strlen((const char*)seq); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 2882 in approximately 0.11 seconds (26688 lines/second) Physical Source Lines of Code (SLOC) = 2148 Hits@level = [0] 51 [1] 3 [2] 23 [3] 2 [4] 0 [5] 0 Hits@level+ = [0+] 79 [1+] 28 [2+] 25 [3+] 2 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 36.7784 [1+] 13.0354 [2+] 11.6387 [3+] 0.931099 [4+] 0 [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.