The following issues were found

src/base58.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: 52 Column: 16 CWE codes: 126

                      psz++;
    }
    // Allocate enough space in big-endian base256 representation.
    int size = strlen(psz) * 733 /1000 + 1; // log(58) / log(256), rounded up.
    std::vector<unsigned char> b256(size);
    // Process the characters.
    static_assert(std::size(mapBase58) == 256, "mapBase58.size() should be 256"); // guarantee not out of range
    while (*psz && !IsSpace(*psz)) {
        // Decode base58 character

            

Reported by FlawFinder.

src/addrman.cpp
1 issues
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?
Security

Line: 684 Column: 31 CWE codes: 362

              std::vector<bool> CAddrMan::DecodeAsmap(fs::path path)
{
    std::vector<bool> bits;
    FILE *filestr = fsbridge::fopen(path, "rb");
    CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
    if (file.IsNull()) {
        LogPrintf("Failed to open asmap file from disk\n");
        return bits;
    }

            

Reported by FlawFinder.

test/functional/wallet_orphanedreward.py
1 issues
Missing class docstring
Error

Line: 10 Column: 1

              from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal

class OrphanedBlockRewardTest(BitcoinTestFramework):
    def set_test_params(self):
        self.setup_clean_chain = True
        self.num_nodes = 2

    def skip_test_if_missing_module(self):

            

Reported by Pylint.

src/rpc/client.cpp
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 231 Column: 15 CWE codes: 120 20

              UniValue ParseNonRFCJSONValue(const std::string& strVal)
{
    UniValue jVal;
    if (!jVal.read(std::string("[")+strVal+std::string("]")) ||
        !jVal.isArray() || jVal.size()!=1)
        throw std::runtime_error(std::string("Error parsing JSON: ") + strVal);
    return jVal[0];
}


            

Reported by FlawFinder.

test/functional/create_cache.py
1 issues
Missing class docstring
Error

Line: 14 Column: 1

              
from test_framework.test_framework import BitcoinTestFramework

class CreateCache(BitcoinTestFramework):
    # Test network and test nodes are not required:

    def set_test_params(self):
        self.num_nodes = 0


            

Reported by Pylint.

src/leveldb/util/no_destructor_test.cc
1 issues
syntax error
Error

Line: 33

              
class NoDestructorTest {};

TEST(NoDestructorTest, StackInstance) {
  NoDestructor<DoNotDestruct> instance(kGoldenA, kGoldenB);
  ASSERT_EQ(kGoldenA, instance.get()->a);
  ASSERT_EQ(kGoldenB, instance.get()->b);
}


            

Reported by Cppcheck.

src/leveldb/util/logging_test.cc
1 issues
syntax error
Error

Line: 16

              
class Logging {};

TEST(Logging, NumberToString) {
  ASSERT_EQ("0", NumberToString(0));
  ASSERT_EQ("1", NumberToString(1));
  ASSERT_EQ("9", NumberToString(9));

  ASSERT_EQ("10", NumberToString(10));

            

Reported by Cppcheck.

src/leveldb/util/histogram.cc
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 243 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
std::string Histogram::ToString() const {
  std::string r;
  char buf[200];
  snprintf(buf, sizeof(buf), "Count: %.0f  Average: %.4f  StdDev: %.2f\n", num_,
           Average(), StandardDeviation());
  r.append(buf);
  snprintf(buf, sizeof(buf), "Min: %.4f  Median: %.4f  Max: %.4f\n",
           (num_ == 0.0 ? 0.0 : min_), Median(), max_);

            

Reported by FlawFinder.

src/leveldb/util/hash_test.cc
1 issues
syntax error
Error

Line: 12

              
class HASH {};

TEST(HASH, SignedUnsignedIssue) {
  const uint8_t data1[1] = {0x62};
  const uint8_t data2[2] = {0xc3, 0x97};
  const uint8_t data3[3] = {0xe2, 0x99, 0xa5};
  const uint8_t data4[4] = {0xe1, 0x80, 0xb9, 0x32};
  const uint8_t data5[48] = {

            

Reported by Cppcheck.

src/wallet/test/db_tests.cpp
1 issues
There is an unknown macro here somewhere. Configuration is required. If BOOST_FIXTURE_TEST_SUITE is a macro then please configure it.
Error

Line: 14

              #include <wallet/bdb.h>


BOOST_FIXTURE_TEST_SUITE(db_tests, BasicTestingSetup)

static std::shared_ptr<BerkeleyEnvironment> GetWalletEnv(const fs::path& path, std::string& database_filename)
{
    fs::path data_file = BDBDataFile(path);
    database_filename = data_file.filename().string();

            

Reported by Cppcheck.