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/libfastahack-1.0.0+dfsg/Fasta.cpp Examining data/libfastahack-1.0.0+dfsg/Fasta.h Examining data/libfastahack-1.0.0+dfsg/FastaHack.cpp Examining data/libfastahack-1.0.0+dfsg/LargeFileSupport.h Examining data/libfastahack-1.0.0+dfsg/Region.h Examining data/libfastahack-1.0.0+dfsg/split.cpp Examining data/libfastahack-1.0.0+dfsg/split.h FINAL RESULTS: data/libfastahack-1.0.0+dfsg/split.cpp:21:5: [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(cstr, s.c_str()); data/libfastahack-1.0.0+dfsg/FastaHack.cpp:65: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. c = getopt_long (argc, argv, "hciedr:", data/libfastahack-1.0.0+dfsg/Fasta.cpp:48:15: [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). indexFile.open(fname.c_str(), ifstream::in); data/libfastahack-1.0.0+dfsg/Fasta.cpp:60:73: [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). this->insert(make_pair(name, FastaIndexEntry(fields[0], atoi(fields[1].c_str()), data/libfastahack-1.0.0+dfsg/Fasta.cpp:62:53: [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). atoi(fields[3].c_str()), data/libfastahack-1.0.0+dfsg/Fasta.cpp:63:53: [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). atoi(fields[4].c_str())))); data/libfastahack-1.0.0+dfsg/Fasta.cpp:136:13: [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). refFile.open(refname.c_str()); data/libfastahack-1.0.0+dfsg/Fasta.cpp:218: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). file.open(fname.c_str()); data/libfastahack-1.0.0+dfsg/Fasta.cpp:248:22: [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). void FastaReference::open(string reffilename) { data/libfastahack-1.0.0+dfsg/Fasta.cpp:250:18: [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 (!(file = fopen(filename.c_str(), "r"))) { data/libfastahack-1.0.0+dfsg/Fasta.h:62:14: [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). void open(string reffilename); data/libfastahack-1.0.0+dfsg/FastaHack.cpp:140:8: [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). fr.open(fastaFileName); data/libfastahack-1.0.0+dfsg/Region.h:27:28: [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). startPos = atoi(region.substr(foundFirstColon + 1).c_str()); data/libfastahack-1.0.0+dfsg/Region.h:31:18: [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). startPos = atoi(region.substr(foundFirstColon + 1, foundRangeDots - foundRangeDots - 1).c_str()); data/libfastahack-1.0.0+dfsg/Region.h:32: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). stopPos = atoi(region.substr(foundRangeDots + 2).c_str()); // to the start of this chromosome data/libfastahack-1.0.0+dfsg/Region.h:34:18: [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). startPos = atoi(region.substr(foundFirstColon + 1, foundRangeDash - foundRangeDash - 1).c_str()); data/libfastahack-1.0.0+dfsg/Region.h:35: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). stopPos = atoi(region.substr(foundRangeDash + 1).c_str()); // to the start of this chromosome data/libfastahack-1.0.0+dfsg/split.cpp:19: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 cchars [s.size()+1]; ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 735 in approximately 0.06 seconds (12992 lines/second) Physical Source Lines of Code (SLOC) = 576 Hits@level = [0] 5 [1] 0 [2] 16 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 23 [1+] 18 [2+] 18 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 39.9306 [1+] 31.25 [2+] 31.25 [3+] 3.47222 [4+] 1.73611 [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.