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/swarm-cluster-3.0.0+dfsg/src/algo.cc Examining data/swarm-cluster-3.0.0+dfsg/src/algod1.cc Examining data/swarm-cluster-3.0.0+dfsg/src/arch.cc Examining data/swarm-cluster-3.0.0+dfsg/src/bloomflex.cc Examining data/swarm-cluster-3.0.0+dfsg/src/bloomflex.h Examining data/swarm-cluster-3.0.0+dfsg/src/bloompat.cc Examining data/swarm-cluster-3.0.0+dfsg/src/bloompat.h Examining data/swarm-cluster-3.0.0+dfsg/src/city.cc Examining data/swarm-cluster-3.0.0+dfsg/src/city.h Examining data/swarm-cluster-3.0.0+dfsg/src/citycrc.h Examining data/swarm-cluster-3.0.0+dfsg/src/db.cc Examining data/swarm-cluster-3.0.0+dfsg/src/derep.cc Examining data/swarm-cluster-3.0.0+dfsg/src/hashtable.cc Examining data/swarm-cluster-3.0.0+dfsg/src/hashtable.h Examining data/swarm-cluster-3.0.0+dfsg/src/matrix.cc Examining data/swarm-cluster-3.0.0+dfsg/src/nw.cc Examining data/swarm-cluster-3.0.0+dfsg/src/qgram.cc Examining data/swarm-cluster-3.0.0+dfsg/src/scan.cc Examining data/swarm-cluster-3.0.0+dfsg/src/search16.cc Examining data/swarm-cluster-3.0.0+dfsg/src/search8.cc Examining data/swarm-cluster-3.0.0+dfsg/src/ssse3.cc Examining data/swarm-cluster-3.0.0+dfsg/src/swarm.cc Examining data/swarm-cluster-3.0.0+dfsg/src/swarm.h Examining data/swarm-cluster-3.0.0+dfsg/src/threads.h Examining data/swarm-cluster-3.0.0+dfsg/src/util.cc Examining data/swarm-cluster-3.0.0+dfsg/src/variants.cc Examining data/swarm-cluster-3.0.0+dfsg/src/variants.h Examining data/swarm-cluster-3.0.0+dfsg/src/zobrist.cc Examining data/swarm-cluster-3.0.0+dfsg/src/zobrist.h FINAL RESULTS: data/swarm-cluster-3.0.0+dfsg/src/algo.cc:294:23: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(internal_structure_file, "\t%" PRIu64, diff); data/swarm-cluster-3.0.0+dfsg/src/algo.cc:433:31: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(internal_structure_file, "\t%" PRIu64, diff); data/swarm-cluster-3.0.0+dfsg/src/algo.cc:434:31: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(internal_structure_file, data/swarm-cluster-3.0.0+dfsg/src/algod1.cc:1049:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(outfile, "swarm_%" PRId64 "\t%" PRIu64, opt_differences, swarmcount_adjusted); data/swarm-cluster-3.0.0+dfsg/src/db.cc:88:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stream, "%.*s_%" PRIu64, hdrlen, h, sp->abundance); data/swarm-cluster-3.0.0+dfsg/src/db.cc:134:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stream, data/swarm-cluster-3.0.0+dfsg/src/derep.cc:226:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(outfile, "swarm_%" PRId64 "\t%" PRIu64, opt_differences, swarmcount); data/swarm-cluster-3.0.0+dfsg/src/matrix.cc:58:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(logfile, "%2" PRId64, score_matrix_63[(i<<5) + j]); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:94:7: [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(GetTickCount()); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:102:7: [3] (random) srandom: 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. srandom(seed); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:108:7: [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(seed); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:110:7: [3] (random) srandom: 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. srandom(seed); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:120:32: [3] (random) random: 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. return static_cast<uint64_t>(random()); data/swarm-cluster-3.0.0+dfsg/src/swarm.cc:362:15: [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 ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) data/swarm-cluster-3.0.0+dfsg/src/algod1.cc:57: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 dummy[3]; /* alignment padding only */ data/swarm-cluster-3.0.0+dfsg/src/arch.cc:96:16: [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). int fd = open("/dev/urandom", O_RDONLY); data/swarm-cluster-3.0.0+dfsg/src/city.cc:597: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 buf[240]; data/swarm-cluster-3.0.0+dfsg/src/city.cc:598: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(buf, s, len); data/swarm-cluster-3.0.0+dfsg/src/db.cc:32:15: [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 signed char map_nt[256] = data/swarm-cluster-3.0.0+dfsg/src/db.cc:194:14: [2] (integer) atol: 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). * number = atol(us + 1); data/swarm-cluster-3.0.0+dfsg/src/db.cc:258:18: [2] (integer) atol: 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). * number = atol(header + i + alen); data/swarm-cluster-3.0.0+dfsg/src/db.cc:379: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[LINEALLOC]; data/swarm-cluster-3.0.0+dfsg/src/db.cc:411:7: [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(datap + datalen, & lineno, sizeof(unsigned int)); data/swarm-cluster-3.0.0+dfsg/src/db.cc:422:7: [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(datap + datalen, line + 1, headerlen); data/swarm-cluster-3.0.0+dfsg/src/db.cc:445:7: [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(datap + datalen, & length, sizeof(unsigned int)); data/swarm-cluster-3.0.0+dfsg/src/db.cc:476:23: [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(datap + datalen, & nt_buffer, sizeof(nt_buffer)); data/swarm-cluster-3.0.0+dfsg/src/db.cc:507:7: [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(datap + datalen_seqlen, & length, sizeof(unsigned int)); data/swarm-cluster-3.0.0+dfsg/src/db.cc:531:11: [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(datap + datalen, & nt_buffer, sizeof(nt_buffer)); data/swarm-cluster-3.0.0+dfsg/src/db.cc:860: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[1025]; data/swarm-cluster-3.0.0+dfsg/src/derep.cc:65:1: [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 map_complement[5] = { 0, 4, 3, 2, 1 }; data/swarm-cluster-3.0.0+dfsg/src/nw.cc:38: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 buf[25]; data/swarm-cluster-3.0.0+dfsg/src/nw.cc:42:7: [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(*cigarendp, buf, static_cast<size_t>(len)); data/swarm-cluster-3.0.0+dfsg/src/nw.cc:56: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 buf[25]; data/swarm-cluster-3.0.0+dfsg/src/nw.cc:60:7: [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(*cigarendp, buf, static_cast<size_t>(len)); data/swarm-cluster-3.0.0+dfsg/src/search16.cc:592: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 * d_address[CHANNELS]; data/swarm-cluster-3.0.0+dfsg/src/search8.cc:829: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 * d_address[CHANNELS]; data/swarm-cluster-3.0.0+dfsg/src/swarm.h:138:18: [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. typedef unsigned char qgramvector_t[QGRAMVECTORBYTES]; data/swarm-cluster-3.0.0+dfsg/src/util.cc:245:12: [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). return fopen(filename, "rb"); data/swarm-cluster-3.0.0+dfsg/src/util.cc:260:12: [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). return fopen(filename, "w"); data/swarm-cluster-3.0.0+dfsg/src/variants.cc:74:7: [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(seq, seed_sequence, nt_bytelength(seed_seqlen)); data/swarm-cluster-3.0.0+dfsg/src/variants.cc:79:7: [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(seq, seed_sequence, nt_bytelength(seed_seqlen)); data/swarm-cluster-3.0.0+dfsg/src/arch.cc:99:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, & seed, sizeof(seed)) < 0) data/swarm-cluster-3.0.0+dfsg/src/db.cc:173:7: [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(header) >= INT_MAX) data/swarm-cluster-3.0.0+dfsg/src/db.cc:215:19: [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). uint64_t hlen = strlen(header); data/swarm-cluster-3.0.0+dfsg/src/db.cc:216:19: [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). uint64_t alen = strlen(attribute); data/swarm-cluster-3.0.0+dfsg/src/db.cc:593:48: [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). seqindex_p->headerlen = static_cast<int>(strlen(seqindex_p->header)); ANALYSIS SUMMARY: Hits = 46 Lines analyzed = 9853 in approximately 0.34 seconds (28583 lines/second) Physical Source Lines of Code (SLOC) = 7092 Hits@level = [0] 256 [1] 5 [2] 27 [3] 6 [4] 8 [5] 0 Hits@level+ = [0+] 302 [1+] 46 [2+] 41 [3+] 14 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 42.5832 [1+] 6.48618 [2+] 5.78116 [3+] 1.97406 [4+] 1.12803 [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.