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/bbhash-1.0.0/BooPHF.h Examining data/bbhash-1.0.0/bootest.cpp Examining data/bbhash-1.0.0/example.cpp Examining data/bbhash-1.0.0/example_custom_hash.cpp FINAL RESULTS: data/bbhash-1.0.0/bootest.cpp:33:22: [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. #define srandomdev() srand((unsigned) time(NULL)) data/bbhash-1.0.0/bootest.cpp:45:8: [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. low = random(); data/bbhash-1.0.0/bootest.cpp:46:9: [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. high = random(); data/bbhash-1.0.0/BooPHF.h:61: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(_buffer,cr._buffer,_buffsize*sizeof(basetype) ); data/bbhash-1.0.0/BooPHF.h:142:10: [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). _is = fopen(filename, "rb"); data/bbhash-1.0.0/BooPHF.h:586: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(_bitArray, r._bitArray, _nchar*sizeof(uint64_t) ); data/bbhash-1.0.0/BooPHF.h:600: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(_bitArray, r._bitArray, _nchar*sizeof(uint64_t) ); data/bbhash-1.0.0/BooPHF.h:1376:4: [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 fname_old[1000]; data/bbhash-1.0.0/BooPHF.h:1377:4: [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(fname_old,"temp_p%i_level_%i",_pid,i-2); data/bbhash-1.0.0/BooPHF.h:1379:4: [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 fname_curr[1000]; data/bbhash-1.0.0/BooPHF.h:1380:4: [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(fname_curr,"temp_p%i_level_%i",_pid,i); data/bbhash-1.0.0/BooPHF.h:1382:4: [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 fname_prev[1000]; data/bbhash-1.0.0/BooPHF.h:1383:4: [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(fname_prev,"temp_p%i_level_%i",_pid,i-1); data/bbhash-1.0.0/BooPHF.h:1396:23: [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). _currlevelFile = fopen(fname_curr,"w"); data/bbhash-1.0.0/bootest.cpp:75: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(_buffer,cr._buffer,_buffsize*sizeof(u_int64_t) ); data/bbhash-1.0.0/bootest.cpp:148:9: [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). _is = fopen(filename, "rb"); data/bbhash-1.0.0/bootest.cpp:481: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). nthreads = atoi(argv[2]); data/bbhash-1.0.0/bootest.cpp:482: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). gammaFactor = atoi(argv[3]); data/bbhash-1.0.0/bootest.cpp:516:14: [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). key_file = fopen("keyfile","w+"); data/bbhash-1.0.0/bootest.cpp:562: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). bench_file = fopen("benchfile","w+"); data/bbhash-1.0.0/bootest.cpp:594:14: [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). vFiles[i]=fopen(("bucket"+to_string(i)).c_str(),"w+"); data/bbhash-1.0.0/example.cpp:30: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). nthreads = atoi(argv[2]); data/bbhash-1.0.0/example_custom_hash.cpp:57: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). nthreads = atoi(argv[2]); data/bbhash-1.0.0/BooPHF.h:784:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_size), sizeof(_size)); data/bbhash-1.0.0/BooPHF.h:785:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_nchar), sizeof(_nchar)); data/bbhash-1.0.0/BooPHF.h:787:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char *>(_bitArray), (std::streamsize)(sizeof(uint64_t) * _nchar)); data/bbhash-1.0.0/BooPHF.h:790:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char *>(&sizer), sizeof(size_t)); data/bbhash-1.0.0/BooPHF.h:792:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(_ranks.data()), (std::streamsize)(sizeof(_ranks[0]) * _ranks.size())); data/bbhash-1.0.0/BooPHF.h:1201:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_gamma), sizeof(_gamma)); data/bbhash-1.0.0/BooPHF.h:1202:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_nb_levels), sizeof(_nb_levels)); data/bbhash-1.0.0/BooPHF.h:1203:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_lastbitsetrank), sizeof(_lastbitsetrank)); data/bbhash-1.0.0/BooPHF.h:1204:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&_nelem), sizeof(_nelem)); data/bbhash-1.0.0/BooPHF.h:1236:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char *>(&final_hash_size), sizeof(size_t)); data/bbhash-1.0.0/BooPHF.h:1243:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char *>(&key), sizeof(elem_t)); data/bbhash-1.0.0/BooPHF.h:1244:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char *>(&value), sizeof(uint64_t)); ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 2683 in approximately 0.08 seconds (34355 lines/second) Physical Source Lines of Code (SLOC) = 1813 Hits@level = [0] 71 [1] 12 [2] 20 [3] 3 [4] 0 [5] 0 Hits@level+ = [0+] 106 [1+] 35 [2+] 23 [3+] 3 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 58.4666 [1+] 19.305 [2+] 12.6862 [3+] 1.65472 [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.