The following issues were found
src/mongo/util/processinfo_solaris.cpp
4 issues
Line: 70
Column: 19
CWE codes:
362
struct ProcPsinfo {
ProcPsinfo() {
FILE* f = fopen("/proc/self/psinfo", "r");
massert(16846,
str::stream() << "couldn't open \"/proc/self/psinfo\": " << errnoWithDescription(),
f);
size_t num = fread(&psinfo, sizeof(psinfo), 1, f);
int err = errno;
Reported by FlawFinder.
Line: 87
Column: 19
CWE codes:
362
struct ProcUsage {
ProcUsage() {
FILE* f = fopen("/proc/self/usage", "r");
massert(16848,
str::stream() << "couldn't open \"/proc/self/usage\": " << errnoWithDescription(),
f);
size_t num = fread(&prusage, sizeof(prusage), 1, f);
int err = errno;
Reported by FlawFinder.
Line: 143
Column: 5
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
"strerror_errno"_attr = strerror(errno));
}
char buf_64[32];
char buf_native[32];
if (sysinfo(SI_ARCHITECTURE_64, buf_64, sizeof(buf_64)) != -1 &&
sysinfo(SI_ARCHITECTURE_NATIVE, buf_native, sizeof(buf_native)) != -1) {
addrSize = str::equals(buf_64, buf_native) ? 64 : 32;
} else {
Reported by FlawFinder.
Line: 144
Column: 5
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
}
char buf_64[32];
char buf_native[32];
if (sysinfo(SI_ARCHITECTURE_64, buf_64, sizeof(buf_64)) != -1 &&
sysinfo(SI_ARCHITECTURE_NATIVE, buf_native, sizeof(buf_native)) != -1) {
addrSize = str::equals(buf_64, buf_native) ? 64 : 32;
} else {
LOGV2(23357,
Reported by FlawFinder.
src/third_party/wiredtiger/test/checkpoint/workers.c
4 issues
Line: 42
Column: 5
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
create_table(WT_SESSION *session, COOKIE *cookie)
{
int ret;
char config[256];
/*
* If we're using timestamps, turn off logging for the table.
*/
if (g.use_timestamps)
Reported by FlawFinder.
Line: 133
Column: 5
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
worker_op(WT_CURSOR *cursor, uint64_t keyno, u_int new_val)
{
int cmp, ret;
char valuebuf[64];
cursor->set_key(cursor, keyno);
/* Roughly half inserts, then balanced inserts / range removes. */
if (new_val > g.nops / 2 && new_val % 39 == 0) {
if ((ret = cursor->search_near(cursor, &cmp)) != 0) {
Reported by FlawFinder.
Line: 198
Column: 5
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
static WT_THREAD_RET
worker(void *arg)
{
char tid[128];
WT_UNUSED(arg);
testutil_check(__wt_thread_str(tid, sizeof(tid)));
printf("worker thread starting: tid: %s\n", tid);
Reported by FlawFinder.
Line: 221
Column: 5
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
WT_SESSION *session;
u_int i, keyno, next_rnd;
int j, ret, t_ret;
char buf[128];
const char *begin_cfg;
bool reopen_cursors, start_txn;
ret = t_ret = 0;
reopen_cursors = false;
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/i18n/vtzone.cpp
4 issues
Line: 954
}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(VTimeZone)
VTimeZone::VTimeZone()
: BasicTimeZone(), tz(NULL), vtzlines(NULL),
lastmod(MAX_MILLIS) {
}
Reported by Cppcheck.
Line: 1261
Column: 27
CWE codes:
120
20
UnicodeString line;
while (TRUE) {
UChar ch = reader.read();
if (ch == 0xFFFF) {
// end of file
if (start && line.startsWith(ICAL_END_VTIMEZONE, -1)) {
vtzlines->addElement(new UnicodeString(line), status);
if (U_FAILURE(status)) {
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/i18n/vzone.cpp
4 issues
Line: 59
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
UBool b = ((VTimeZone*)zone)->VTimeZone::getTZURL(s);
urlLength = s.length();
memcpy(url,s.getBuffer(),urlLength);
return b;
}
U_CAPI void U_EXPORT2
Reported by FlawFinder.
Line: 87
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
resultLength = s.length();
result = (UChar*)uprv_malloc(resultLength);
memcpy(result,s.getBuffer(),resultLength);
return;
}
U_CAPI void U_EXPORT2
Reported by FlawFinder.
Line: 99
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
resultLength = s.length();
result = (UChar*)uprv_malloc(resultLength);
memcpy(result,s.getBuffer(),resultLength);
return;
}
U_CAPI void U_EXPORT2
Reported by FlawFinder.
Line: 111
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
resultLength = s.length();
result = (UChar*)uprv_malloc(resultLength);
memcpy(result,s.getBuffer(),resultLength);
return;
}
U_CAPI int32_t U_EXPORT2
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/i18n/coll.cpp
4 issues
Line: 861
CollationLocaleListEnumeration::~CollationLocaleListEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationLocaleListEnumeration)
// -------------------------------------
StringEnumeration* U_EXPORT2
Reported by Cppcheck.
Line: 292
Column: 14
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
{ "upper", UCOL_UPPER_FIRST }
};
static const char *collReorderCodes[UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST] = {
"space", "punct", "symbol", "currency", "digit"
};
int32_t getReorderCode(const char *s) {
for (int32_t i = 0; i < UPRV_LENGTHOF(collReorderCodes); ++i) {
Reported by FlawFinder.
Line: 324
Column: 5
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
// No keywords.
return;
}
char value[1024]; // The reordering value could be long.
// Check for collation keywords that were already deprecated
// before any were supported in createInstance() (except for "collation").
int32_t length = loc.getKeywordValue("colHiraganaQuaternary", value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
Reported by FlawFinder.
Line: 906
Column: 5
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
Collator::getFunctionalEquivalent(const char* keyword, const Locale& locale,
UBool& isAvailable, UErrorCode& status) {
// This is a wrapper over ucol_getFunctionalEquivalent
char loc[ULOC_FULLNAME_CAPACITY];
/*int32_t len =*/ ucol_getFunctionalEquivalent(loc, sizeof(loc),
keyword, locale.getName(), &isAvailable, &status);
if (U_FAILURE(status)) {
*loc = 0; // root
}
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/i18n/numfmt.cpp
4 issues
Line: 62
Column: 5
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
#ifdef FMT_DEBUG
#include <stdio.h>
static inline void debugout(UnicodeString s) {
char buf[2000];
s.extract((int32_t) 0, s.length(), buf);
printf("%s", buf);
}
#define debug(x) printf("%s", x);
#else
Reported by FlawFinder.
Line: 133
Column: 14
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
static const char *gNumberElements = "NumberElements";
static const char *gLatn = "latn";
static const char *gPatterns = "patterns";
static const char *gFormatKeys[UNUM_FORMAT_STYLE_COUNT] = {
NULL, // UNUM_PATTERN_DECIMAL
"decimalFormat", // UNUM_DECIMAL
"currencyFormat", // UNUM_CURRENCY
"percentFormat", // UNUM_PERCENT
"scientificFormat", // UNUM_SCIENTIFIC
Reported by FlawFinder.
Line: 1035
Column: 9
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
NumberFormat*
NumberFormat::internalCreateInstance(const Locale& loc, UNumberFormatStyle kind, UErrorCode& status) {
if (kind == UNUM_CURRENCY) {
char cfKeyValue[kKeyValueLenMax] = {0};
UErrorCode kvStatus = U_ZERO_ERROR;
int32_t kLen = loc.getKeywordValue("cf", cfKeyValue, kKeyValueLenMax, kvStatus);
if (U_SUCCESS(kvStatus) && kLen > 0 && uprv_strcmp(cfKeyValue,"account")==0) {
kind = UNUM_CURRENCY_ACCOUNTING;
}
Reported by FlawFinder.
Line: 1324
Column: 9
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
#if U_PLATFORM_USES_ONLY_WIN32_API
if (!mustBeDecimalFormat) {
char buffer[8];
int32_t count = desiredLocale.getKeywordValue("compat", buffer, sizeof(buffer), status);
// if the locale has "@compat=host", create a host-specific NumberFormat
if (U_SUCCESS(status) && count > 0 && uprv_strcmp(buffer, "host") == 0) {
Win32NumberFormat *f = NULL;
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/common/unicode/locid.h
4 issues
Line: 743
Column: 5
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
*/
static Locale *getLocaleCache(void);
char language[ULOC_LANG_CAPACITY];
char script[ULOC_SCRIPT_CAPACITY];
char country[ULOC_COUNTRY_CAPACITY];
int32_t variantBegin;
char* fullName;
char fullNameBuffer[ULOC_FULLNAME_CAPACITY];
Reported by FlawFinder.
Line: 744
Column: 5
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
static Locale *getLocaleCache(void);
char language[ULOC_LANG_CAPACITY];
char script[ULOC_SCRIPT_CAPACITY];
char country[ULOC_COUNTRY_CAPACITY];
int32_t variantBegin;
char* fullName;
char fullNameBuffer[ULOC_FULLNAME_CAPACITY];
// name without keywords
Reported by FlawFinder.
Line: 745
Column: 5
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
char language[ULOC_LANG_CAPACITY];
char script[ULOC_SCRIPT_CAPACITY];
char country[ULOC_COUNTRY_CAPACITY];
int32_t variantBegin;
char* fullName;
char fullNameBuffer[ULOC_FULLNAME_CAPACITY];
// name without keywords
char* baseName;
Reported by FlawFinder.
Line: 748
Column: 5
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
char country[ULOC_COUNTRY_CAPACITY];
int32_t variantBegin;
char* fullName;
char fullNameBuffer[ULOC_FULLNAME_CAPACITY];
// name without keywords
char* baseName;
void initBaseName(UErrorCode& status);
UBool fIsBogus;
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/common/umapfile.c
4 issues
Line: 177
Column: 12
CWE codes:
362
length=mystat.st_size;
/* open the file */
fd=open(path, O_RDONLY);
if(fd==-1) {
return FALSE;
}
/* get a view of the mapping */
Reported by FlawFinder.
Line: 239
Column: 14
CWE codes:
362
UDataMemory_init(pData); /* Clear the output struct. */
/* open the input file */
file=fopen(path, "rb");
if(file==NULL) {
return FALSE;
}
/* get the file length */
Reported by FlawFinder.
Line: 363
Column: 9
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
U_CFUNC UBool uprv_mapFile(UDataMemory *pData, const char *path) {
const char *inBasename;
char *basename;
char pathBuffer[1024];
const DataHeader *pHeader;
dllhandle *handle;
void *val=0;
inBasename=uprv_strrchr(path, U_FILE_SEP_CHAR);
Reported by FlawFinder.
Line: 390
Column: 16
CWE codes:
362
length=mystat.st_size;
/* open the file */
fd=open(path, O_RDONLY);
if(fd==-1) {
return FALSE;
}
/* get a view of the mapping */
Reported by FlawFinder.
buildscripts/idl/idl/cpp_types.py
4 issues
Line: 35
Column: 1
import textwrap
from typing import Any, List, Optional
from . import ast
from . import bson
from . import common
from . import writer
_STD_ARRAY_UINT8_16 = 'std::array<std::uint8_t,16>'
Reported by Pylint.
Line: 36
Column: 1
from typing import Any, List, Optional
from . import ast
from . import bson
from . import common
from . import writer
_STD_ARRAY_UINT8_16 = 'std::array<std::uint8_t,16>'
Reported by Pylint.
Line: 37
Column: 1
from . import ast
from . import bson
from . import common
from . import writer
_STD_ARRAY_UINT8_16 = 'std::array<std::uint8_t,16>'
Reported by Pylint.
Line: 38
Column: 1
from . import ast
from . import bson
from . import common
from . import writer
_STD_ARRAY_UINT8_16 = 'std::array<std::uint8_t,16>'
def is_primitive_scalar_type(cpp_type):
Reported by Pylint.
src/third_party/icu4c-57.1/source/common/ucnv_bld.cpp
4 issues
Line: 206
Column: 8
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
#if !U_CHARSET_IS_UTF8
/* This contains the resolved converter name. So no further alias lookup is needed again. */
static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */
static const char *gDefaultConverterName = NULL;
/*
If the default converter is an algorithmic converter, this is the cached value.
We don't cache a full UConverter and clone it because ucnv_clone doesn't have
Reported by FlawFinder.
Line: 381
Column: 5
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
uint32_t mid, start, limit;
uint32_t lastMid;
int result;
char strippedName[UCNV_MAX_CONVERTER_NAME_LENGTH];
/* Lower case and remove ignoreable characters. */
ucnv_io_stripForCompare(strippedName, realName);
/* do a binary search for the alias */
Reported by FlawFinder.
Line: 1009
Column: 37
CWE codes:
362
myUConverter->toUCallbackReason = UCNV_ILLEGAL; /* default reason to invoke (*fromCharErrorBehaviour) */
}
if(mySharedConverterData->impl->open != NULL) {
mySharedConverterData->impl->open(myUConverter, pArgs, err);
if(U_FAILURE(*err) && !pArgs->onlyTestIsLoadable) {
/* don't ucnv_close() if onlyTestIsLoadable because not fully initialized */
ucnv_close(myUConverter);
return NULL;
Reported by FlawFinder.
Line: 1010
Column: 38
CWE codes:
362
}
if(mySharedConverterData->impl->open != NULL) {
mySharedConverterData->impl->open(myUConverter, pArgs, err);
if(U_FAILURE(*err) && !pArgs->onlyTestIsLoadable) {
/* don't ucnv_close() if onlyTestIsLoadable because not fully initialized */
ucnv_close(myUConverter);
return NULL;
}
Reported by FlawFinder.