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/mrs-6.0.5+dfsg/matrix/matrices.h Examining data/mrs-6.0.5+dfsg/src/M6BitStream.cpp Examining data/mrs-6.0.5+dfsg/src/M6BitStream.h Examining data/mrs-6.0.5+dfsg/src/M6Blast.cpp Examining data/mrs-6.0.5+dfsg/src/M6Blast.h Examining data/mrs-6.0.5+dfsg/src/M6BlastCache.cpp Examining data/mrs-6.0.5+dfsg/src/M6Builder.cpp Examining data/mrs-6.0.5+dfsg/src/M6Config.cpp Examining data/mrs-6.0.5+dfsg/src/M6Config.h Examining data/mrs-6.0.5+dfsg/src/M6DataSource.cpp Examining data/mrs-6.0.5+dfsg/src/M6DataSource.h Examining data/mrs-6.0.5+dfsg/src/M6Databank.cpp Examining data/mrs-6.0.5+dfsg/src/M6Dictionary.cpp Examining data/mrs-6.0.5+dfsg/src/M6Dictionary.h Examining data/mrs-6.0.5+dfsg/src/M6DocStore.cpp Examining data/mrs-6.0.5+dfsg/src/M6DocStore.h Examining data/mrs-6.0.5+dfsg/src/M6Document.cpp Examining data/mrs-6.0.5+dfsg/src/M6Document.h Examining data/mrs-6.0.5+dfsg/src/M6Error.cpp Examining data/mrs-6.0.5+dfsg/src/M6Error.h Examining data/mrs-6.0.5+dfsg/src/M6Exec.cpp Examining data/mrs-6.0.5+dfsg/src/M6Exec.h Examining data/mrs-6.0.5+dfsg/src/M6Fetch.cpp Examining data/mrs-6.0.5+dfsg/src/M6Fetch.h Examining data/mrs-6.0.5+dfsg/src/M6File.cpp Examining data/mrs-6.0.5+dfsg/src/M6File.h Examining data/mrs-6.0.5+dfsg/src/M6Index.cpp Examining data/mrs-6.0.5+dfsg/src/M6Index.h Examining data/mrs-6.0.5+dfsg/src/M6Iterator.cpp Examining data/mrs-6.0.5+dfsg/src/M6Lexicon.cpp Examining data/mrs-6.0.5+dfsg/src/M6Lexicon.h Examining data/mrs-6.0.5+dfsg/src/M6Lib.h Examining data/mrs-6.0.5+dfsg/src/M6Log.cpp Examining data/mrs-6.0.5+dfsg/src/M6Log.h Examining data/mrs-6.0.5+dfsg/src/M6MD5.cpp Examining data/mrs-6.0.5+dfsg/src/M6MD5.h Examining data/mrs-6.0.5+dfsg/src/M6Matrix.h Examining data/mrs-6.0.5+dfsg/src/M6Parser.h Examining data/mrs-6.0.5+dfsg/src/M6Progress.cpp Examining data/mrs-6.0.5+dfsg/src/M6Progress.h Examining data/mrs-6.0.5+dfsg/src/M6Query.cpp Examining data/mrs-6.0.5+dfsg/src/M6Query.h Examining data/mrs-6.0.5+dfsg/src/M6Queue.h Examining data/mrs-6.0.5+dfsg/src/M6Tokenizer.h Examining data/mrs-6.0.5+dfsg/src/M6Utilities.cpp Examining data/mrs-6.0.5+dfsg/src/M6Utilities.h Examining data/mrs-6.0.5+dfsg/src/M6WSBlast.cpp Examining data/mrs-6.0.5+dfsg/src/M6WSBlast.h Examining data/mrs-6.0.5+dfsg/src/M6WSSearch.h Examining data/mrs-6.0.5+dfsg/src/M6Matrix.cpp Examining data/mrs-6.0.5+dfsg/src/M6Databank.h Examining data/mrs-6.0.5+dfsg/src/M6BlastCache.h Examining data/mrs-6.0.5+dfsg/src/M6Builder.h Examining data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp Examining data/mrs-6.0.5+dfsg/src/M6Iterator.h Examining data/mrs-6.0.5+dfsg/src/M6Server.h Examining data/mrs-6.0.5+dfsg/src/M6Server.cpp Examining data/mrs-6.0.5+dfsg/src/M6Tokenizer.cpp Examining data/mrs-6.0.5+dfsg/src/M6WSSearch.cpp Examining data/mrs-6.0.5+dfsg/src/M6Parser.cpp Examining data/mrs-6.0.5+dfsg/unicode/M6UnicodeTables.h Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestBitStream.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestBuilder.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestDatabank.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestDocStore.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestIndex.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestIterators.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestLex.cpp Examining data/mrs-6.0.5+dfsg/unit-tests/M6TestMain.cpp FINAL RESULTS: data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:247:7: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if (readlink("/proc/self/exe", path, sizeof(path)) == -1) data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:271:7: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if (readlink((boost::format("/proc/%1%/exe") % pid).str().c_str(), path, sizeof(path)) > 0) data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:297:6: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if (readlink("/proc/self/exe", path, sizeof(path)) > 0) data/mrs-6.0.5+dfsg/src/M6BlastCache.cpp:270:11: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. boost::system::error_code ec; data/mrs-6.0.5+dfsg/src/M6BlastCache.cpp:556:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. boost::system::error_code ec; data/mrs-6.0.5+dfsg/src/M6Config.cpp:111:9: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. boost::system::error_code ec; data/mrs-6.0.5+dfsg/src/M6Error.cpp:34:10: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int n = vsnprintf(mMessage, sizeof(mMessage), inMessage, vl); data/mrs-6.0.5+dfsg/src/M6Error.cpp:60:2: [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(sLastWhat, mMessage); data/mrs-6.0.5+dfsg/src/M6Error.cpp:93:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, inMessage, vl); data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:673:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. boost::system::error_code error; data/mrs-6.0.5+dfsg/src/M6File.cpp:103:3: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access, shareMode, nullptr, create, flags, nullptr)); data/mrs-6.0.5+dfsg/src/M6Server.cpp:80: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. boost::random::random_device rng; data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:35: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 mBuffer[kFileBufferSize]; data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:52: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(mBufferPtr, inData, inSize); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:63: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(mBufferPtr, inData, n); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:80: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(mBufferPtr, inData, inSize); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:118: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(t, mBuffer, size); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:125:2: [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(mBufferPtr, inData, inSize); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:158:2: [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(mData, inStream.mData, mByteOffset + 1); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:169:2: [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(mData, inStream.mData, mByteOffset + 1); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:189: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(mData, inStream.mData, mByteOffset + 1); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:209: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(mData, inStream.mData, mByteOffset + 1); data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:330: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 mDataBuffer[1]; data/mrs-6.0.5+dfsg/src/M6BitStream.cpp:343:2: [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(mDataBuffer, inImpl.mBufferPtr, mBufferSize); data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:343: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 msg[256]; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:344:2: [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(msg, "terminated on signal %d", inSignal); data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:358: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 msg[128]; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:362:27: [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. case CTRL_C_EVENT: sprintf(msg, "terminated on CTRL-C"); break; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:363:30: [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. case CTRL_BREAK_EVENT: sprintf(msg, "terminated on CTRL-BREAK"); break; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:364:30: [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. case CTRL_CLOSE_EVENT: sprintf(msg, "terminated on close event"); break; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:365:31: [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. case CTRL_LOGOFF_EVENT: sprintf(msg, "terminated on logging off"); break; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:366:32: [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. case CTRL_SHUTDOWN_EVENT: sprintf(msg, "terminated on shutdown"); break; data/mrs-6.0.5+dfsg/src/M6CmdLineDriver.cpp:367:19: [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. default: sprintf(msg, "terminated on unknown event"); break; data/mrs-6.0.5+dfsg/src/M6Config.h:110: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). result = atoi(e->get_attribute("max-run-time").c_str()); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:274:10: [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 block[512]; data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:321: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 block[512]; data/mrs-6.0.5+dfsg/src/M6Dictionary.cpp:553:11: [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. unsigned char mS0[kMaxStringLength]; data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:411: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(dst, inData, result); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:442:2: [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(outData, src, size); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:477:2: [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(dst.mData + inDstIndex, src.mData + inSrcIndex, inCount * sizeof(M6DocStoreIndexEntry)); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:750: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 mBuffer[kM6DataPageTextSize]; data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:775:2: [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(mBuffer, inSource.mBufferStart, n); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:789: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(mBuffer, inSource.mBufferStart, n); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:823: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(s, mBufferStart, k); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:913: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(attr + 1, inName.c_str(), inName.length()); data/mrs-6.0.5+dfsg/src/M6Error.cpp:24: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 sLastWhat[512]; data/mrs-6.0.5+dfsg/src/M6Error.h:23: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 mMessage[512]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:124: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[1024]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:179: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 buffer[1024]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:301: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[1024]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:490: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[1024]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:532: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[1024]; data/mrs-6.0.5+dfsg/src/M6Exec.cpp:713:6: [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[4096]; data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:233:2: [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(&sa.sin_addr, host->h_addr, host->h_length); data/mrs-6.0.5+dfsg/src/M6File.cpp:83: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). M6Handle open(const std::string& inFile, MOpenMode inMode) data/mrs-6.0.5+dfsg/src/M6File.cpp:223: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). M6Handle open(const std::string& inFile, MOpenMode inMode) data/mrs-6.0.5+dfsg/src/M6File.cpp:232:11: [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(inFile.c_str(), mode, 0644); data/mrs-6.0.5+dfsg/src/M6File.cpp:322:25: [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). mImpl->mHandle = M6IO::open(inFile, inMode); data/mrs-6.0.5+dfsg/src/M6File.cpp:331:25: [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). mImpl->mHandle = M6IO::open(inFile.string(), inMode); data/mrs-6.0.5+dfsg/src/M6File.h:27:11: [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). M6Handle open(const std::string& inFile, MOpenMode inMode); data/mrs-6.0.5+dfsg/src/M6Index.cpp:62: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 mReason[512]; data/mrs-6.0.5+dfsg/src/M6Index.cpp:603:2: [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(k + 1, inKey.c_str(), *k); data/mrs-6.0.5+dfsg/src/M6Index.cpp:661:2: [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(k + 1, inKey.c_str(), inKey.length()); data/mrs-6.0.5+dfsg/src/M6Index.cpp:704:2: [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(dst, src, byteCount); data/mrs-6.0.5+dfsg/src/M6Index.cpp:710:2: [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(dst, src, byteCount); data/mrs-6.0.5+dfsg/src/M6Index.cpp:1826:2: [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(mPageData.mBits + mPageData.mN, inData, result); data/mrs-6.0.5+dfsg/src/M6Index.cpp:1863: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(mData, inBitVector.mBits, kM6BitVectorInlineBitsSize); data/mrs-6.0.5+dfsg/src/M6Index.cpp:1872: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(mData, inBitVector.mLeadingBits, kM6BitVectorLeadingBitsSize); data/mrs-6.0.5+dfsg/src/M6Index.cpp:1889: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(mData, inImpl.mBufferPtr, inImpl.mBufferSize); data/mrs-6.0.5+dfsg/src/M6Index.cpp:2014: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(outBitVector.mBits, data, size); data/mrs-6.0.5+dfsg/src/M6Index.cpp:2040: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(outBitVector.mLeadingBits, data, kM6BitVectorLeadingBitsSize); data/mrs-6.0.5+dfsg/src/M6Lexicon.cpp:34: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 s[kLexDataSize]; data/mrs-6.0.5+dfsg/src/M6Lexicon.cpp:49:6: [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(s + e[N + 1], inWord, inWordLength); data/mrs-6.0.5+dfsg/src/M6Lib.h:19:8: [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). #undef fopen data/mrs-6.0.5+dfsg/src/M6MD5.cpp:60: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(mData + mDataLength, p, n); data/mrs-6.0.5+dfsg/src/M6MD5.cpp:81: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(mData, p, inLength); data/mrs-6.0.5+dfsg/src/M6Progress.cpp:77: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 databank[32]; data/mrs-6.0.5+dfsg/src/M6Progress.cpp:79: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 stage[220]; data/mrs-6.0.5+dfsg/src/M6Progress.cpp:173: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(&i->progress, &inProgress, sizeof(float)); data/mrs-6.0.5+dfsg/src/M6Server.cpp:1198:65: [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). string db = inDatabank; if (ba::starts_with(db, "$")) db = m[atoi(db.c_str() + 1)]; data/mrs-6.0.5+dfsg/src/M6Server.cpp:1199:60: [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). string id = inID; if (ba::starts_with(id, "$")) id = m[atoi(id.c_str() + 1)]; data/mrs-6.0.5+dfsg/src/M6Server.cpp:1200:62: [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). string ix = inIndex; if (ba::starts_with(ix, "$")) ix = m[atoi(ix.c_str() + 1)]; data/mrs-6.0.5+dfsg/src/M6Server.cpp:1202:63: [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). string an = inAnchor; if (ba::starts_with(an, "$")) an = m[atoi(an.c_str() + 1)]; data/mrs-6.0.5+dfsg/src/M6Server.cpp:3564: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). acceptor.open(endpoint.protocol()); data/mrs-6.0.5+dfsg/src/M6Tokenizer.h:96: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 mTokenText[kTokenBufferLength]; // private buffer data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:99: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). outfile.open(inLogFile); data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:107: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). errfile.open(inErrFile); data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:246: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 path[PATH_MAX] = ""; data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:270: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 path[PATH_MAX] = ""; data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:296: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 path[PATH_MAX] = ""; data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:356:2: [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). open("/dev/null", O_RDONLY); data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:377:11: [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(inLogFile.c_str(), O_CREAT|O_APPEND|O_RDWR, 0644); data/mrs-6.0.5+dfsg/src/M6Utilities.cpp:389:7: [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). fd = open(inErrFile.c_str(), O_CREAT|O_APPEND|O_RDWR, 0644); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:46:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(Source& src, char* s, streamsize n); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:180:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:260:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:269:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = io::read(mFile, s, n); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:275:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). io::read(mFile, block, mTail); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:324:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize n = io::read(mStream, block, sizeof(block)); data/mrs-6.0.5+dfsg/src/M6DataSource.cpp:378:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = io::read(mStream, block, sizeof(block)); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:746:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n); data/mrs-6.0.5+dfsg/src/M6DocStore.cpp:798:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize M6DocSource::read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6Document.cpp:360:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&c, 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:364:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&l), 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:366:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&c, 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:411:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&c, 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:417:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&l), 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:422:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&buffer[0], l); data/mrs-6.0.5+dfsg/src/M6Document.cpp:453:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&c, 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:457:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(reinterpret_cast<char*>(&l), 1); data/mrs-6.0.5+dfsg/src/M6Document.cpp:459:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(&c, 1); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:128:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize k = io::read(in, buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:257:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:305:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize k = io::read(inRawData, buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:382:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize M6ProcessImpl::read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6Exec.cpp:494:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize k = io::read(stdin, buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:537:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(ofd[0], buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:549:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(efd[0], buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:598:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:640:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize M6ProcessImpl::read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6Exec.cpp:715:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize n = io::read(mRawData, buffer, sizeof(buffer)); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:754:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return ::read(mOFD, s, n); data/mrs-6.0.5+dfsg/src/M6Exec.cpp:787:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize M6Process::read(char* s, streamsize n) data/mrs-6.0.5+dfsg/src/M6Exec.cpp:789:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return mImpl->read(s, n); data/mrs-6.0.5+dfsg/src/M6Exec.h:31:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). std::streamsize read(char* s, std::streamsize n); data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:100:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inline int read(SOCKET s, char* data, int len) { return ::recv(s, data, len, 0); } data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:114:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n) { return static_cast<streamsize>(::read(mSocket, s, n)); } data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:114:77: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). streamsize read(char* s, streamsize n) { return static_cast<streamsize>(::read(mSocket, s, n)); } data/mrs-6.0.5+dfsg/src/M6Fetch.cpp:656:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((r = io::read(stream, buffer.data(), buffer.size())) > 0) data/mrs-6.0.5+dfsg/src/M6File.cpp:196:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/mrs-6.0.5+dfsg/src/M6File.cpp:197:97: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (not ::ReadFile(reinterpret_cast<HANDLE>(inHandle), inBuffer, static_cast<DWORD>(inSize), &read, &p) or read == 0) data/mrs-6.0.5+dfsg/src/M6File.cpp:203:76: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (not ::GetOverlappedResult(reinterpret_cast<HANDLE>(inHandle), &p, &read, true)) data/mrs-6.0.5+dfsg/src/M6File.cpp:212:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inSize -= read; data/mrs-6.0.5+dfsg/src/M6File.cpp:213:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inOffset += read; data/mrs-6.0.5+dfsg/src/M6File.cpp:214:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). buffer += read; data/mrs-6.0.5+dfsg/src/M6Parser.cpp:435:35: [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). uint32 len = static_cast<uint32>(strlen(inEntry)); data/mrs-6.0.5+dfsg/src/M6Progress.cpp:163:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.databank, inDatabank.c_str(), sizeof(info.databank) - 1); data/mrs-6.0.5+dfsg/src/M6Progress.cpp:164:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.stage, inStage.c_str(), sizeof(info.stage) - 1); data/mrs-6.0.5+dfsg/src/M6Progress.cpp:171:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(i->stage, inStage.c_str(), sizeof(i->stage) - 1); data/mrs-6.0.5+dfsg/src/M6Server.cpp:224:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). doc.read(request.payload); data/mrs-6.0.5+dfsg/src/M6Server.cpp:1062:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). doc.read(data); data/mrs-6.0.5+dfsg/unit-tests/M6TestLex.cpp:63:30: [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). M6Tokenizer tok(test.text, strlen(test.text)); data/mrs-6.0.5+dfsg/unit-tests/M6TestLex.cpp:90:23: [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). M6Tokenizer tok2(s2, strlen(s2)); ANALYSIS SUMMARY: Hits = 143 Lines analyzed = 70104 in approximately 1.60 seconds (43947 lines/second) Physical Source Lines of Code (SLOC) = 61573 Hits@level = [0] 5 [1] 50 [2] 81 [3] 1 [4] 8 [5] 3 Hits@level+ = [0+] 148 [1+] 143 [2+] 93 [3+] 12 [4+] 11 [5+] 3 Hits/KSLOC@level+ = [0+] 2.40365 [1+] 2.32245 [2+] 1.5104 [3+] 0.194891 [4+] 0.17865 [5+] 0.0487227 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.