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/libsecrecy-0.0.2+dfsg/src/apps/secrecy.cpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/AESEncryptKey.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMCryptBase.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMEncrypter.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMFactoryBase.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMIV.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMInputStream.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMInputStreamBuffer.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMOutputStream.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMOutputStreamBuffer.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMStreamBase.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMStreamBlockHeader.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMStreamHeader.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEContext.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEErrorBase.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEInputStreamWrapper.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEInputStringWrapper.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEOutputLockedStringWrapper.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEOutputStreamWrapper.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEOutputStringWrapper.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEVersionCheck.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/LockedMemory.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/NumToHex.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/RawKey.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/Yarrow.hpp Examining data/libsecrecy-0.0.2+dfsg/src/libsecrecy/libsecrecy.hpp Examining data/libsecrecy-0.0.2+dfsg/src/test/testEncDec.cpp Examining data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp FINAL RESULTS: data/libsecrecy-0.0.2+dfsg/src/libsecrecy/RawKey.hpp:97:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char const * keydir = getenv(libsecrecy_keydir_envvar); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/RawKey.hpp:106:25: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char const * home = getenv(HOME_envvar); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:44: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. v |= random()&0xFF; data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:62:5: [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(::time(nullptr)); data/libsecrecy-0.0.2+dfsg/src/apps/secrecy.cpp:382:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/apps/secrecy.cpp:479:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). std::cin.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:40:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(char * const cdata, ::std::size_t const len) = 0; data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:41:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(uint8_t * data, ::std::size_t len) = 0; data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:104:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(char * const cdata, ::std::size_t const len) data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:110:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read( data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:116:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(uint8_t * data, ::std::size_t len) data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:133:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(reinterpret_cast<char *>(B.get()),use); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:154:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(reinterpret_cast<char *>(&rdigest[0]),GCM_DIGEST_SIZE); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMDecrypter.hpp:165:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(&digest[0],&digest[GCM_DIGEST_SIZE],&rdigest[0]) ) data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMInputStreamBuffer.hpp:153:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). interface->read(LB.get(),buffersize); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMInputStreamBuffer.hpp:317:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). interface->read(p,buffersize); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GCMStreamHeader.hpp:135:32: [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::size_t const l_magic = strlen(magic); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/GPGMEInputStreamWrapper.hpp:50:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). istr.read(reinterpret_cast<char *>(buffer),size); data/libsecrecy-0.0.2+dfsg/src/libsecrecy/RawKey.hpp:557:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(L.begin(),L.end(),K.L.begin()) ) data/libsecrecy-0.0.2+dfsg/src/libsecrecy/RawKey.hpp:559:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(H.get(),H.get()+digestsize,K.H.get()) ) data/libsecrecy-0.0.2+dfsg/src/test/testEncDec.cpp:87:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). dec.read(B.begin(),msg.size()); data/libsecrecy-0.0.2+dfsg/src/test/testEncDec.cpp:89:13: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( std::equal(msg.begin(),msg.end(),B.begin()) ) data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:93:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(A.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:94:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). plainistr.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:101:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(A.get(),A.get()+r,B.get()) ) data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:120:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). plainistr.read(A.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:121:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:128:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(A.get(),A.get()+r,B.get()) ) data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:143:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). plainistr.read(A.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:144:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:151:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(A.get(),A.get()+r,B.get()) ) data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:166:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). plainistr.read(A.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:167:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:174:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(A.get(),A.get()+r,B.get()) ) data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:204:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). plainistr.read(A.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:205:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GIS.read(B.get(),readblocksize); data/libsecrecy-0.0.2+dfsg/src/test/testSeek.cpp:212:16: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( ! std::equal(A.get(),A.get()+r,B.get()) ) ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 5226 in approximately 0.15 seconds (34866 lines/second) Physical Source Lines of Code (SLOC) = 3524 Hits@level = [0] 0 [1] 33 [2] 0 [3] 4 [4] 0 [5] 0 Hits@level+ = [0+] 37 [1+] 37 [2+] 4 [3+] 4 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 10.4994 [1+] 10.4994 [2+] 1.13507 [3+] 1.13507 [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.