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/r-bioc-chemminer-3.42.0+dfsg/src/DisjointSets.cpp Examining data/r-bioc-chemminer-3.42.0+dfsg/src/DisjointSets.h Examining data/r-bioc-chemminer-3.42.0+dfsg/src/cluster.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/cstrsplit.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/debug.h Examining data/r-bioc-chemminer-3.42.0+dfsg/src/desc.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/desc.h Examining data/r-bioc-chemminer-3.42.0+dfsg/src/fingerprints.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/molecule.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/molecule.h Examining data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/script.cc Examining data/r-bioc-chemminer-3.42.0+dfsg/src/script.h Examining data/r-bioc-chemminer-3.42.0+dfsg/src/similarity.cc FINAL RESULTS: data/r-bioc-chemminer-3.42.0+dfsg/src/debug.h:5:34: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEBUG_PRINT(fmt,...) LOC printf(fmt,__VA_ARGS__); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:681: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(r,name); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:1286:15: [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). *cptr = strcpy(*cptr, cstr); data/r-bioc-chemminer-3.42.0+dfsg/src/cluster.cc:59: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 line_buf[LINE_BUF_SIZE]; data/r-bioc-chemminer-3.42.0+dfsg/src/desc.h:39:8: [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 char elements[112][3] = { data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:17: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 num[4]; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:20:12: [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). n_atoms = atoi(num); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:24:12: [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). n_bonds = atoi(num); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:30: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 ele[4] = {0x0, 0x0, 0x0, 0x0}; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:58: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 num[4]; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:61:9: [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). left = atoi(num); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:65:10: [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). right = atoi(num); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:69:14: [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). bond_type = atoi(num); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:92: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[MAX_LINE_LENGTH+2]; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:221: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 line[MAX_LINE_LENGTH+2]; line[MAX_LINE_LENGTH+1] = '\0'; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:222: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 buf_4[5]; buf_4[4] = '\0'; data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:632:16: [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 const char hex[17] = "0123456789abcdef"; data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:1056: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(pack, ptr, sz); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:1074: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(ptr, sobj->pack, size); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:1279:43: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:18:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(num, buf, 3); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:22:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(num, buf + 3, 3); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:59:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(num, buf, 3); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:63:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(num, buf + 3, 3); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:67:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(num, buf + 6, 3); data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:98:22: [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 (ifs.fail() or strlen(buf) > MAX_LINE_LENGTH) { data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:99:9: [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(buf) > MAX_LINE_LENGTH) data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:100:106: [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). std::cerr << "SDF not well-formatted : line exceeds "<<MAX_LINE_LENGTH<<" characters" << " len=" << strlen(buf) << " last=" << buf[strlen(buf) - 1] << std::endl; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:100:137: [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). std::cerr << "SDF not well-formatted : line exceeds "<<MAX_LINE_LENGTH<<" characters" << " len=" << strlen(buf) << " last=" << buf[strlen(buf) - 1] << std::endl; data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:228: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(line) > MAX_LINE_LENGTH) { data/r-bioc-chemminer-3.42.0+dfsg/src/formats.cc:237:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf_4, line, 4); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:385: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). const char* te = tb + strlen(tb); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:404: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). const char* te = tb + strlen(tb); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:680: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(name) + 1 > (bsz - (r - buff))) return 0; data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:701:26: [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). size_t lname = (name ? strlen(name) : 0); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:706:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(r,name,lname+1); data/r-bioc-chemminer-3.42.0+dfsg/src/r_wrap.cc:1275:15: [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). int len = strlen(cstr); ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 3861 in approximately 0.11 seconds (34323 lines/second) Physical Source Lines of Code (SLOC) = 2734 Hits@level = [0] 15 [1] 17 [2] 17 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 52 [1+] 37 [2+] 20 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 19.0198 [1+] 13.5333 [2+] 7.31529 [3+] 1.09729 [4+] 1.09729 [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.