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/berkeley-express-1.5.3+dfsg/src/biascorrection.cpp Examining data/berkeley-express-1.5.3+dfsg/src/biascorrection.h Examining data/berkeley-express-1.5.3+dfsg/src/bundles.cpp Examining data/berkeley-express-1.5.3+dfsg/src/bundles.h Examining data/berkeley-express-1.5.3+dfsg/src/directiondetector.cpp Examining data/berkeley-express-1.5.3+dfsg/src/directiondetector.h Examining data/berkeley-express-1.5.3+dfsg/src/fragments.cpp Examining data/berkeley-express-1.5.3+dfsg/src/fragments.h Examining data/berkeley-express-1.5.3+dfsg/src/frequencymatrix.h Examining data/berkeley-express-1.5.3+dfsg/src/lengthdistribution.h Examining data/berkeley-express-1.5.3+dfsg/src/library.h Examining data/berkeley-express-1.5.3+dfsg/src/logger.h Examining data/berkeley-express-1.5.3+dfsg/src/main.h Examining data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp Examining data/berkeley-express-1.5.3+dfsg/src/mapparser.h Examining data/berkeley-express-1.5.3+dfsg/src/markovmodel.cpp Examining data/berkeley-express-1.5.3+dfsg/src/mismatchmodel.h Examining data/berkeley-express-1.5.3+dfsg/src/robertsfilter.cpp Examining data/berkeley-express-1.5.3+dfsg/src/robertsfilter.h Examining data/berkeley-express-1.5.3+dfsg/src/sequence.cpp Examining data/berkeley-express-1.5.3+dfsg/src/sequence.h Examining data/berkeley-express-1.5.3+dfsg/src/targets.cpp Examining data/berkeley-express-1.5.3+dfsg/src/targets.h Examining data/berkeley-express-1.5.3+dfsg/src/threadsafety.cpp Examining data/berkeley-express-1.5.3+dfsg/src/threadsafety.h Examining data/berkeley-express-1.5.3+dfsg/src/lengthdistribution.cpp Examining data/berkeley-express-1.5.3+dfsg/src/markovmodel.h Examining data/berkeley-express-1.5.3+dfsg/src/mismatchmodel.cpp Examining data/berkeley-express-1.5.3+dfsg/src/main.cpp FINAL RESULTS: data/berkeley-express-1.5.3+dfsg/src/logger.h:56:5: [4] (format) vsnprintf: 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. vsnprintf(buffer, BUFF_SIZE, msg, arg); data/berkeley-express-1.5.3+dfsg/src/logger.h:66:5: [4] (format) vsnprintf: 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. vsnprintf(buffer, BUFF_SIZE, msg, arg); data/berkeley-express-1.5.3+dfsg/src/logger.h:76:5: [4] (format) vsnprintf: 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. vsnprintf(buffer, BUFF_SIZE, msg, arg); data/berkeley-express-1.5.3+dfsg/src/main.cpp:380:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff, "%s/x_%d", output_dir.c_str(), n); data/berkeley-express-1.5.3+dfsg/src/main.cpp:394:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff, "%s/params.%d.xprs", dir.c_str(), (int)l+1); data/berkeley-express-1.5.3+dfsg/src/main.cpp:396:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buff, "%s/params.xprs", dir.c_str()); data/berkeley-express-1.5.3+dfsg/src/main.cpp:776:3: [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). strcpy(buff, in_map_file_names.c_str()); data/berkeley-express-1.5.3+dfsg/src/main.cpp:789:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(out_map_file_name, "%s/hits.%d.prob", data/berkeley-express-1.5.3+dfsg/src/main.cpp:793:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(out_map_file_name, "%s/hits.%d.samp", data/berkeley-express-1.5.3+dfsg/src/main.cpp:1083:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((unsigned int)time(NULL)); data/berkeley-express-1.5.3+dfsg/src/biascorrection.cpp:47:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/biascorrection.cpp:120:3: [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 buff[200]; data/berkeley-express-1.5.3+dfsg/src/biascorrection.cpp:123: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(buff, "\t%d", i-CENTER+1); data/berkeley-express-1.5.3+dfsg/src/lengthdistribution.cpp:72:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/lengthdistribution.cpp:180:3: [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 buffer[50]; data/berkeley-express-1.5.3+dfsg/src/lengthdistribution.cpp:182: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(buffer, "%e\t",sexp(pmf(i*_bin_size))); data/berkeley-express-1.5.3+dfsg/src/logger.h:53: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 buffer[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/logger.h:63: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 buffer[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/logger.h:73: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 buffer[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/main.cpp:377:3: [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 buff[500]; data/berkeley-express-1.5.3+dfsg/src/main.cpp:775:3: [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 buff[999]; data/berkeley-express-1.5.3+dfsg/src/main.cpp:787: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 out_map_file_name[500] = ""; data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:358:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:386:31: [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). _targ_lengths[name] = atoi(len.c_str()); data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:404:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:441:20: [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). sam_flag = atoi(p); data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:478:27: [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). r.left = (size_t)(atoi(p)-1); data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:506:20: [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). r.mate_l = atoi(p)-1; data/berkeley-express-1.5.3+dfsg/src/mapparser.cpp:534:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/mismatchmodel.cpp:47:3: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/targets.cpp:380:12: [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). infile.open(haplotype_file.c_str()); data/berkeley-express-1.5.3+dfsg/src/targets.cpp:384:7: [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 line_buff[BUFF_SIZE]; data/berkeley-express-1.5.3+dfsg/src/targets.cpp:590:22: [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 * expr_file = fopen((output_dir + "/results.xprs").c_str(), "w"); data/berkeley-express-1.5.3+dfsg/src/targets.cpp:594:19: [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). varcov_file.open((output_dir + "/varcov.xprs").c_str()); data/berkeley-express-1.5.3+dfsg/src/targets.cpp:597:17: [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). rdds_file.open((output_dir + "/rdds.xprs").c_str()); data/berkeley-express-1.5.3+dfsg/src/targets.cpp:388: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). if (strlen(line_buff) == 0) { ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 8269 in approximately 0.26 seconds (31591 lines/second) Physical Source Lines of Code (SLOC) = 4785 Hits@level = [0] 2 [1] 1 [2] 25 [3] 1 [4] 9 [5] 0 Hits@level+ = [0+] 38 [1+] 36 [2+] 35 [3+] 10 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 7.94148 [1+] 7.52351 [2+] 7.31452 [3+] 2.08986 [4+] 1.88088 [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.