The following issues were found

src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
1 issues
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)
Security

Line: 401 Column: 26 CWE codes: 126

              
    StringData config = configElem.valueStringData();
    // Do NOT allow embedded null characters
    if (config.size() != strlen(config.rawData())) {
        return {ErrorCodes::FailedToParse, "malformed 'configString' value."};
    }

    Status status = wtRCToStatus(
        wiredtiger_config_validate(nullptr, &eventHandler, "WT_SESSION.create", config.rawData()));

            

Reported by FlawFinder.

src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp
1 issues
syntax error
Error

Line: 138

                  std::unique_ptr<OperationContext> _opCtx;
};

TEST_F(WiredTigerUtilMetadataTest, GetMetadataCreateInvalid) {
    StatusWith<std::string> result =
        WiredTigerUtil::getMetadataCreate(getOperationContext(), getURI());
    ASSERT_NOT_OK(result.getStatus());
    ASSERT_EQUALS(ErrorCodes::NoSuchKey, result.getStatus().code());
}

            

Reported by Cppcheck.

src/mongo/db/thread_client_test.cpp
1 issues
syntax error
Error

Line: 43

              
class ThreadClientTest : public unittest::Test, public ScopedGlobalServiceContextForTest {};

TEST_F(ThreadClientTest, TestNoAssignment) {
    ASSERT_FALSE(haveClient());
    { ThreadClient tc(getThreadName(), getGlobalServiceContext()); }
    ASSERT_FALSE(haveClient());
}


            

Reported by Cppcheck.

src/mongo/db/time_proof_service_test.cpp
1 issues
syntax error
Error

Line: 45

              const TimeProofService::Key key = {};

// Verifies cluster time with proof signed with the correct key.
TEST(TimeProofService, VerifyLogicalTimeWithValidProof) {
    TimeProofService timeProofService;

    LogicalTime time(Timestamp(1));
    TimeProof proof = timeProofService.getProof(time, key);


            

Reported by Cppcheck.

src/mongo/db/timeseries/bucket_catalog_test.cpp
1 issues
syntax error
Error

Line: 181

                  return builder.obj().getIntField("numWaits");
}

TEST_F(BucketCatalogTest, InsertIntoSameBucket) {
    // The first insert should be able to take commit rights, but batch is still active
    auto result1 =
        _bucketCatalog->insert(_opCtx,
                               _ns1,
                               _getCollator(_ns1),

            

Reported by Cppcheck.

src/mongo/db/timeseries/minmax.cpp
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 91 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                  // Store element as BSONElement buffer but strip out the field name
    _value.buffer[0] = elem.type();
    _value.buffer[1] = '\0';
    memcpy(_value.buffer.get() + 2, elem.value(), elem.valuesize());
    _value.size = requiredSize;
    _type = Type::kValue;
    _updated = true;
}


            

Reported by FlawFinder.

src/mongo/db/timeseries/minmax_test.cpp
1 issues
syntax error
Error

Line: 50

                                         });
}

TEST(MinMax, Insert) {
    MinMaxStore minmax;

    // No subelements to start
    auto obj = minmax.root();
    ASSERT_EQ(std::distance(obj.begin(), obj.end()), 0);

            

Reported by Cppcheck.

src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp
1 issues
syntax error
Error

Line: 101

                  }
}

TEST(TimeseriesIndexSchemaConversionTest, OriginalSpecFieldName) {
    TimeseriesOptions timeseriesOptions = makeTimeseriesOptions();

    BSONObj bucketsIndexSpec =
        BSON(timeseries::kKeyFieldName << BSON("control.min.a" << 1 << "control.max.a" << 1)
                                       << timeseries::kOriginalSpecFieldName << BSON("abc" << 123));

            

Reported by Cppcheck.

src/mongo/db/timeseries/timeseries_update_delete_util_test.cpp
1 issues
syntax error
Error

Line: 54

                  NamespaceString _ns{"timeseries_update_delete_util_test", "system.buckets.t"};
};

TEST_F(TimeseriesUpdateDeleteUtilTest, QueryOnlyDependsOnMetaFieldNoMetaField) {
    // Empty query.
    ASSERT_TRUE(timeseries::queryOnlyDependsOnMetaField(
        _opCtx.get(), _ns, BSONObj(), boost::none, LegacyRuntimeConstants(), boost::none));

    // Query on the "meta" field.

            

Reported by Cppcheck.

src/mongo/db/traffic_recorder.cpp
1 issues
Syntax Error: AST broken, 'if' doesn't have two operands.
Error

Line: 56

              bool shouldAlwaysRecordTraffic = false;

MONGO_INITIALIZER(ShouldAlwaysRecordTraffic)(InitializerContext*) {
    if (!gAlwaysRecordTraffic.size()) {
        return;
    }

    if (gTrafficRecordingDirectory.empty()) {
        if (serverGlobalParams.logpath.empty()) {

            

Reported by Cppcheck.