Result of svn merge -r57264:57370 svn+ssh://svn/svn/linden/branches/adroit.r40-68 into release.

master
Aaron Brashears 2007-02-02 17:28:58 +00:00
parent 54d89549df
commit 305c74d516
226 changed files with 2223 additions and 1811 deletions

View File

@ -156,8 +156,8 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
//--------------------------------------------------------------------
char path[LL_MAX_PATH]; /* Flawfinder: ignore */
snprintf( path, sizeof(path), "%s",
gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName).c_str()); /* Flawfinder: ignore */
snprintf( path, sizeof(path), "%s",/* Flawfinder: ignore */
gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName).c_str());
apr_file_t *fp = ll_apr_file_open(path, LL_APR_R);
@ -190,7 +190,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
// check the 1st token on the line to determine if it's empty or a comment
//----------------------------------------------------------------
char token[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %127s", token) != 1 )
if ( sscanf(mLine, " %127s", token) != 1 ) /* Flawfinder: ignore */
continue;
if (token[0] == '#')
@ -225,7 +225,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if (loadingGlobals && LLString::compareInsensitive(token, "emote")==0)
{
char emote_str[1024]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %1023s", emote_str) != 1 )
if ( sscanf(mLine, " %*s = %1023s", emote_str) != 1 ) /* Flawfinder: ignore */
return ST_NO_XLT_EMOTE;
mEmoteName.assign( emote_str );
@ -263,7 +263,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
{
mLoop = TRUE;
}
else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 )
else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 ) /* Flawfinder: ignore */
{
mLoop = (LLString::compareInsensitive(trueFalse, "true")==0);
}
@ -285,7 +285,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
{
F32 duration;
char type[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %f %127s", &duration, type) != 2 )
if ( sscanf(mLine, " %*s = %f %127s", &duration, type) != 2 ) /* Flawfinder: ignore */
return ST_NO_XLT_EASEIN;
mEaseIn = duration;
@ -298,8 +298,8 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if (loadingGlobals && LLString::compareInsensitive(token, "easeout")==0)
{
F32 duration;
char type[128];
if ( sscanf(mLine, " %*s = %f %127s", &duration, type) != 2 )
char type[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %f %127s", &duration, type) != 2 ) /* Flawfinder: ignore */
return ST_NO_XLT_EASEOUT;
mEaseOut = duration;
@ -324,7 +324,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
Constraint constraint;
// try reading optional target direction
if(sscanf(
if(sscanf( /* Flawfinder: ignore */
mLine,
" %*s = %d %f %f %f %f %15s %f %f %f %15s %f %f %f %f %f %f",
&constraint.mChainLength,
@ -344,7 +344,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
&constraint.mTargetDir.mV[VY],
&constraint.mTargetDir.mV[VZ]) != 16)
{
if(sscanf(
if(sscanf( /* Flawfinder: ignore */
mLine,
" %*s = %d %f %f %f %f %15s %f %f %f %15s %f %f %f",
&constraint.mChainLength,
@ -384,7 +384,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
Constraint constraint;
// try reading optional target direction
if(sscanf(
if(sscanf( /* Flawfinder: ignore */
mLine,
" %*s = %d %f %f %f %f %15s %f %f %f %15s %f %f %f %f %f %f",
&constraint.mChainLength,
@ -404,7 +404,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
&constraint.mTargetDir.mV[VY],
&constraint.mTargetDir.mV[VZ]) != 16)
{
if(sscanf(
if(sscanf( /* Flawfinder: ignore */
mLine,
" %*s = %d %f %f %f %f %15s %f %f %f %15s %f %f %f",
&constraint.mChainLength,
@ -452,7 +452,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if ( LLString::compareInsensitive(token, "ignore")==0 )
{
char trueFalse[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %127s", trueFalse) != 1 )
if ( sscanf(mLine, " %*s = %127s", trueFalse) != 1 ) /* Flawfinder: ignore */
return ST_NO_XLT_IGNORE;
trans->mIgnore = (LLString::compareInsensitive(trueFalse, "true")==0);
@ -470,7 +470,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
{
trans->mRelativePosition.setVec( x, y, z );
}
else if ( sscanf(mLine, " %*s = %127s", relpos) == 1 )
else if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */
{
if ( LLString::compareInsensitive(relpos, "firstkey")==0 )
{
@ -496,7 +496,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
{
//F32 x, y, z;
char relpos[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %127s", relpos) == 1 )
if ( sscanf(mLine, " %*s = %127s", relpos) == 1 ) /* Flawfinder: ignore */
{
if ( LLString::compareInsensitive(relpos, "firstkey")==0 )
{
@ -521,7 +521,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if ( LLString::compareInsensitive(token, "outname")==0 )
{
char outName[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %127s", outName) != 1 )
if ( sscanf(mLine, " %*s = %127s", outName) != 1 ) /* Flawfinder: ignore */
return ST_NO_XLT_OUTNAME;
trans->mOutName = outName;
@ -566,7 +566,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if ( LLString::compareInsensitive(token, "mergeparent")==0 )
{
char mergeParentName[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %127s", mergeParentName) != 1 )
if ( sscanf(mLine, " %*s = %127s", mergeParentName) != 1 ) /* Flawfinder: ignore */
return ST_NO_XLT_MERGEPARENT;
trans->mMergeParentName = mergeParentName;
@ -579,7 +579,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)
if ( LLString::compareInsensitive(token, "mergechild")==0 )
{
char mergeChildName[128]; /* Flawfinder: ignore */
if ( sscanf(mLine, " %*s = %127s", mergeChildName) != 1 )
if ( sscanf(mLine, " %*s = %127s", mergeChildName) != 1 ) /* Flawfinder: ignore */
return ST_NO_XLT_MERGECHILD;
trans->mMergeChildName = mergeChildName;
@ -705,7 +705,7 @@ LLBVHLoader::Status LLBVHLoader::loadBVHFile(const char *buffer, char* error_tex
// get the joint name
//----------------------------------------------------------------
char jointName[80]; /* Flawfinder: ignore */
if ( sscanf(line.c_str(), "%*s %79s", jointName) != 1 )
if ( sscanf(line.c_str(), "%*s %79s", jointName) != 1 ) /* Flawfinder: ignore */
{
strncpy(error_text, line.c_str(), 127); /* Flawfinder: ignore */
return ST_NO_NAME;

View File

@ -1701,9 +1701,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
{
success &= dp.packU8(shared_constraintp->mChainLength, "chain_length");
success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type");
char volume_name[16];
snprintf(volume_name, sizeof(volume_name), "%s",
mCharacter->findCollisionVolume(shared_constraintp->mSourceConstraintVolume)->getName().c_str()); /* Flawfinder: ignore */
char volume_name[16]; /* Flawfinder: ignore */
snprintf(volume_name, sizeof(volume_name), "%s", /* Flawfinder: ignore */
mCharacter->findCollisionVolume(shared_constraintp->mSourceConstraintVolume)->getName().c_str());
success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "source_volume");
success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset");
if (shared_constraintp->mConstraintTargetType == TYPE_GROUND)
@ -1712,8 +1712,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
}
else
{
snprintf(volume_name, sizeof(volume_name),"%s",
mCharacter->findCollisionVolume(shared_constraintp->mTargetConstraintVolume)->getName().c_str()); /* Flawfinder: ignore */
snprintf(volume_name, sizeof(volume_name),"%s", /* Flawfinder: ignore */
mCharacter->findCollisionVolume(shared_constraintp->mTargetConstraintVolume)->getName().c_str());
}
success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "target_volume");
success &= dp.packVector3(shared_constraintp->mTargetConstraintOffset, "target_offset");

View File

@ -329,9 +329,9 @@ BOOL LLKeyframeMotionParam::loadMotions()
// Load data into a buffer to be parsed.
//-------------------------------------------------------------------------
char path[LL_MAX_PATH]; /* Flawfinder: ignore */
snprintf( path, sizeof(path), "%s_%s.llp",
snprintf( path,sizeof(path), "%s_%s.llp", /* Flawfinder: ignore */
gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()).c_str(),
getName().c_str() ); /* Flawfinder: ignore */
getName().c_str() );
//-------------------------------------------------------------------------
// open the file
@ -406,7 +406,7 @@ BOOL LLKeyframeMotionParam::loadMotions()
// get priority
//-------------------------------------------------------------------------
BOOL isFirstMotion = TRUE;
num = sscanf(p, "%79s %79s %f", strA, strB, &floatA);
num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */
while(1)
{
@ -432,7 +432,7 @@ BOOL LLKeyframeMotionParam::loadMotions()
}
p++;
num = sscanf(p, "%79s %79s %f", strA, strB, &floatA);
num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */
}
delete [] text;

View File

@ -180,7 +180,7 @@ inline std::string llerror_file_line(const char* file, S32 line)
#endif
// handy compile-time assert - enforce those template parameters!
#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1]
#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */
// Makes the app go down in flames, but on purpose!
void _llcrash_and_loop();

View File

@ -165,9 +165,9 @@ void llifstream::close()
}
}
void llifstream::open(const char *_Filename,
void llifstream::open(const char* _Filename, /* Flawfinder: ignore */
ios_base::openmode _Mode,
int _Prot) /* Flawfinder: ignore */
int _Prot)
{ // open a C stream with specified mode
FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::in, _Prot);
@ -211,9 +211,9 @@ bool llofstream::is_open() const
return false;
}
void llofstream::open(const char *_Filename,
void llofstream::open(const char* _Filename, /* Flawfinder: ignore */
ios_base::openmode _Mode,
int _Prot) /* Flawfinder: ignore */
int _Prot)
{ // open a C stream with specified mode
FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::out, _Prot);

View File

@ -88,9 +88,9 @@ public:
return _Filebuffer;
}
bool is_open() const;
void open(const char *_Filename,
void open(const char* _Filename, /* Flawfinder: ignore */
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */
int _Prot = (int)ios_base::_Openprot);
void close();
private:

View File

@ -61,7 +61,7 @@
// Deal with the differeneces on Windows
#if defined(LL_WINDOWS)
#define snprintf _snprintf
#define snprintf _snprintf /*Flawfinder: ignore*/
#endif // LL_WINDOWS
// Static linking with apr on windows needs to be declared.

View File

@ -585,7 +585,7 @@ bool CProcessor::AnalyzeIntelProcessor()
mov sig3, edx
}
// Then we convert the data to a readable string
snprintf(
snprintf( /* Flawfinder: ignore */
CPUInfo.strProcessorSerial,
sizeof(CPUInfo.strProcessorSerial),
"%04lX-%04lX-%04lX-%04lX-%04lX-%04lX",
@ -593,15 +593,15 @@ bool CProcessor::AnalyzeIntelProcessor()
sig1 & 0xFFFF,
sig3 >> 16,
sig3 & 0xFFFF,
sig2 >> 16, sig2 & 0xFFFF); /* Flawfinder: ignore */
sig2 >> 16, sig2 & 0xFFFF);
}
else
{
// If there's no serial number support we just put "No serial number"
snprintf(
snprintf( /* Flawfinder: ignore */
CPUInfo.strProcessorSerial,
sizeof(CPUInfo.strProcessorSerial),
"No Processor Serial Number"); /* Flawfinder: ignore */
"No Processor Serial Number");
}
// Now we get the standard processor extensions
@ -835,7 +835,7 @@ bool CProcessor::AnalyzeAMDProcessor()
break;
case 0xD: // Model = 0xD: K6-2+ / K6-III+
strcpy(CPUInfo.strModel, "AMD K6-2+ or K6-III+ (0.18 micron)"); /* Flawfinder: ignore */
strncat(strCPUName, "AMD K6-2+ or K6-III+ (0.18 micron)", sizeof(strCPUName) - strlen(strCPUName) -1);
strncat(strCPUName, "AMD K6-2+ or K6-III+ (0.18 micron)", sizeof(strCPUName) - strlen(strCPUName) -1); /* Flawfinder: ignore */
break;
default: // ...
strcpy(CPUInfo.strModel, "Unknown AMD K5 or K6 model"); /* Flawfinder: ignore */

View File

@ -785,7 +785,7 @@ S32 LLSDBinaryParser::parse(std::istream& istr, LLSD& data) const
// the size, and read it.
// *FIX: Should we set a maximum size?
U32 size_nbo = 0;
istr.read((char*)&size_nbo, sizeof(U32));
istr.read((char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(size_nbo);
std::vector<U8> value;
if(size)
@ -925,7 +925,7 @@ void LLSDFormatter::realFormat(const std::string& format)
void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const
{
char buffer[MAX_STRING]; /* Flawfinder: ignore */
snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real);
snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real); /* Flawfinder: ignore */
ostr << buffer;
}

View File

@ -82,7 +82,7 @@ struct char_traits<U16>
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return static_cast<char_type*>(memcpy(__s1, __s2, __n * sizeof(char_type))); }
{ return static_cast<char_type*>(memcpy(__s1, __s2, __n * sizeof(char_type))); } /* Flawfinder: ignore */
static char_type*
assign(char_type* __s, size_t __n, char_type __a)

View File

@ -113,23 +113,23 @@ LLOSInfo::LLOSInfo() :
char tmp[MAX_STRING]; /* Flawfinder: ignore */
if(osvi.dwMajorVersion <= 4)
{
snprintf(
snprintf( /* Flawfinder: ignore */
tmp,
sizeof(tmp),
"version %d.%d %s (Build %d)",
osvi.dwMajorVersion,
osvi.dwMinorVersion,
csdversion.c_str(),
(osvi.dwBuildNumber & 0xffff)); /* Flawfinder: ignore */
(osvi.dwBuildNumber & 0xffff));
}
else
{
snprintf(
snprintf( /* Flawfinder: ignore */
tmp,
sizeof(tmp),
"%s (Build %d)",
csdversion.c_str(),
(osvi.dwBuildNumber & 0xffff)); /*Flawfinder: ignore*/
(osvi.dwBuildNumber & 0xffff));
}
mOSString += tmp;
}
@ -231,7 +231,7 @@ U32 LLOSInfo::getProcessVirtualSizeKB()
#if LL_WINDOWS
#endif
#if LL_LINUX
FILE *status_filep = LLFile::fopen("/proc/self/status", "r");
FILE* status_filep = LLFile::fopen("/proc/self/status", "r"); /* Flawfinder: ignore */
S32 numRead = 0;
char buff[STATUS_SIZE]; /* Flawfinder: ignore */
bzero(buff, STATUS_SIZE);
@ -257,7 +257,7 @@ U32 LLOSInfo::getProcessResidentSizeKB()
#if LL_WINDOWS
#endif
#if LL_LINUX
FILE *status_filep = LLFile::fopen("/proc/self/status", "r");
FILE* status_filep = LLFile::fopen("/proc/self/status", "r"); /* Flawfinder: ignore */
if (status_filep != NULL)
{
S32 numRead = 0;

View File

@ -47,27 +47,27 @@ char* U64_to_str(U64 value, char* result, S32 result_size)
if (part1)
{
snprintf(
snprintf( /* Flawfinder: ignore */
result,
result_size,
"%u%07u%07u",
part1,part2,part3); /* Flawfinder: ignore */
part1,part2,part3);
}
else if (part2)
{
snprintf(
snprintf( /* Flawfinder: ignore */
result,
result_size,
"%u%07u",
part2,part3); /* Flawfinder: ignore */
part2,part3);
}
else
{
snprintf(
snprintf( /* Flawfinder: ignore */
result,
result_size,
"%u",
part3); /* Flawfinder: ignore */
part3);
}
return (result);
}

View File

@ -148,7 +148,7 @@ U8* LLImageBase::reallocateData(S32 size)
if (mData)
{
S32 bytes = llmin(mDataSize, size);
memcpy(new_datap, mData, bytes);
memcpy(new_datap, mData, bytes); /* Flawfinder: ignore */
delete[] mData;
}
mData = new_datap;
@ -245,7 +245,11 @@ BOOL LLImageRaw::copyData(U8 *data, U16 width, U16 height, S8 components)
{
return FALSE;
}
memcpy(getData(), data, width*height*components);
if (getData() == NULL || data == NULL)
{
return FALSE;
}
memcpy(getData(), data, width*height*components); /* Flawfinder: ignore */
return TRUE;
}
@ -269,11 +273,16 @@ U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const
U8 *data = new U8[width*height*getComponents()];
// Should do some simple bounds checking
if (!data)
{
llerrs << "Out of memory in LLImageRaw::getSubImage" << llendl;
return NULL;
}
U32 i;
for (i = y_pos; i < y_pos+height; i++)
{
memcpy(data + i*width*getComponents(),
memcpy(data + i*width*getComponents(), /* Flawfinder: ignore */
getData() + ((y_pos + i)*getWidth() + x_pos)*getComponents(), getComponents()*width);
}
return data;
@ -309,7 +318,7 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
{
from_offset = i*width*getComponents();
}
memcpy(getData() + to_offset*getComponents(),
memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */
data + from_offset, getComponents()*width);
}
}
@ -326,7 +335,7 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
{
from_offset = (height - 1 - i)*width*getComponents();
}
memcpy(getData() + to_offset*getComponents(),
memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */
data + from_offset, getComponents()*width);
}
}
@ -373,14 +382,19 @@ void LLImageRaw::verticalFlip()
LLMemType mt1((LLMemType::EMemType)mMemType);
S32 row_bytes = getWidth() * getComponents();
U8* line_buffer = new U8[row_bytes];
if (!line_buffer )
{
llerrs << "Out of memory in LLImageRaw::verticalFlip()" << llendl;
return;
}
S32 mid_row = getHeight() / 2;
for( S32 row = 0; row < mid_row; row++ )
{
U8* row_a_data = getData() + row * row_bytes;
U8* row_b_data = getData() + (getHeight() - 1 - row) * row_bytes;
memcpy( line_buffer, row_a_data, row_bytes );
memcpy( row_a_data, row_b_data, row_bytes );
memcpy( row_b_data, line_buffer, row_bytes );
memcpy( line_buffer, row_a_data, row_bytes ); /* Flawfinder: ignore */
memcpy( row_a_data, row_b_data, row_bytes ); /* Flawfinder: ignore */
memcpy( row_b_data, line_buffer, row_bytes ); /* Flawfinder: ignore */
}
delete[] line_buffer;
}
@ -672,7 +686,7 @@ void LLImageRaw::copyUnscaled(LLImageRaw* src)
llassert( src->getComponents() == dst->getComponents() );
llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() );
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() ); /* Flawfinder: ignore */
}
@ -756,7 +770,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() );
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() ); /* Flawfinder: ignore */
return;
}
@ -822,7 +836,12 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
// copy out existing image data
S32 temp_data_size = old_width * old_height * getComponents();
U8* temp_buffer = new U8[ temp_data_size ];
memcpy(temp_buffer, getData(), temp_data_size);
if (!temp_buffer)
{
llerrs << "Out of memory in LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )" << llendl;
return;
}
memcpy(temp_buffer, getData(), temp_data_size); /* Flawfinder: ignore */
// allocate new image data, will delete old data
U8* new_buffer = allocateDataSize(new_width, new_height, getComponents());
@ -831,7 +850,7 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
{
if (row < old_height)
{
memcpy(new_buffer + (new_width * row * getComponents()), temp_buffer + (old_width * row * getComponents()), getComponents() * llmin(old_width, new_width));
memcpy(new_buffer + (new_width * row * getComponents()), temp_buffer + (old_width * row * getComponents()), getComponents() * llmin(old_width, new_width)); /* Flawfinder: ignore */
if (old_width < new_width)
{
// pad out rest of row with black
@ -1185,7 +1204,7 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on
llassert(image.notNull());
U8 *buffer = image->allocateData(length);
ifs.read ((char*)buffer, length);
ifs.read ((char*)buffer, length); /* Flawfinder: ignore */
ifs.close();
image->updateData();
@ -1534,7 +1553,7 @@ BOOL LLImageFormatted::copyData(U8 *data, S32 size)
{
deleteData();
allocateData(size);
memcpy(getData(), data, size);
memcpy(getData(), data, size); /* Flawfinder: ignore */
}
updateData(); // virtual
@ -1548,15 +1567,20 @@ BOOL LLImageFormatted::appendData(U8 *data, S32 size)
U8* old_data = getData();
S32 new_size = old_size + size;
U8* new_data = new U8[new_size];
if (!new_data)
{
llerrs << "Out of memory in LLImageFormatted::appendData(U8 *data, S32 size)" << llendl;
return FALSE;
}
// resize the image
setDataAndSize(new_data, new_size);
// copy the old data and delete it
memcpy(new_data, old_data, old_size);
memcpy(new_data, old_data, old_size); /* Flawfinder: ignore */
delete old_data;
// if we have new data, copy it and call updateData()
if (data)
{
memcpy(new_data + old_size, data, size);
memcpy(new_data + old_size, data, size); /* Flawfinder: ignore */
updateData(); // virtual
}
return TRUE;

View File

@ -123,7 +123,10 @@ BOOL LLImageBMP::updateData()
LLBMPHeader header;
llassert( sizeof( header ) == BITMAP_HEADER_SIZE );
memcpy((void *)&header, mdata + FILE_HEADER_SIZE, BITMAP_HEADER_SIZE);
memcpy( /* Flawfinder: ignore */
(void*)&header,
mdata + FILE_HEADER_SIZE,
BITMAP_HEADER_SIZE);
// convert BMP header from little endian (no-op on little endian builds)
llendianswizzleone(header.mSize);
@ -257,7 +260,7 @@ BOOL LLImageBMP::updateData()
extension_size = 4 * 3;
memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, extension_size);
memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, extension_size); /* Flawfinder: ignore */
}
else
if( windows_95_version )
@ -266,11 +269,11 @@ BOOL LLImageBMP::updateData()
extension_size = sizeof( win_95_extension );
llassert( sizeof( win_95_extension ) + BITMAP_HEADER_SIZE == 108 );
memcpy( &win_95_extension, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, sizeof( win_95_extension ) );
memcpy( &win_95_extension, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, sizeof( win_95_extension ) ); /* Flawfinder: ignore */
if( 3 == header.mCompression )
{
memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, 4 * 4);
memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, 4 * 4); /* Flawfinder: ignore */
}
// Color correction ignored for now
@ -298,7 +301,12 @@ BOOL LLImageBMP::updateData()
if( 0 != mColorPaletteColors )
{
mColorPalette = new U8[color_palette_size];
memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size );
if (!mColorPalette)
{
llerrs << "Out of memory in LLImageBMP::updateData()" << llendl;
return FALSE;
}
memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); /* Flawfinder: ignore */
}
return TRUE;
@ -568,7 +576,7 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time)
U32 cur_pos = 0;
memcpy(mdata, magic, 14);
cur_pos += 14;
memcpy(mdata+cur_pos, &header, 40);
memcpy(mdata+cur_pos, &header, 40); /* Flawfinder: ignore */
cur_pos += 40;
if (getComponents() == 1)
{

View File

@ -260,7 +260,7 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time)
}
raw_image->resize(width, height, ncomponents);
memcpy(raw_image->getData(), data, image_size);
memcpy(raw_image->getData(), data, image_size); /* Flawfinder: ignore */
return TRUE;
}
@ -354,7 +354,7 @@ BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mip
S32 bytes = formatBytes(format, w, h);
if (mip==0)
{
memcpy(mipdata, raw_image->getData(), bytes);
memcpy(mipdata, raw_image->getData(), bytes); /* Flawfinder: ignore */
}
else if (explicit_mips)
{
@ -406,15 +406,20 @@ bool LLImageDXT::convertToDXR()
S32 total_bytes = getDataSize();
U8* olddata = getData();
U8* newdata = new U8[total_bytes];
if (!newdata)
{
llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl;
return false;
}
llassert(total_bytes > 0);
memset(newdata, 0, total_bytes);
memcpy(newdata, olddata, mHeaderSize);
memcpy(newdata, olddata, mHeaderSize); /* Flawfinder: ignore */
for (S32 mip=0; mip<nmips; mip++)
{
S32 bytes = formatBytes(mFileFormat, width, height);
S32 newoffset = getMipOffset(mip);
S32 oldoffset = mHeaderSize + (total_bytes - newoffset - bytes);
memcpy(newdata + newoffset, olddata + oldoffset, bytes);
memcpy(newdata + newoffset, olddata + oldoffset, bytes); /* Flawfinder: ignore */
width >>= 1;
height >>= 1;
}
@ -468,7 +473,7 @@ void LLImageDXT::extractMip(const U8 *indata, U8* mipdata, int width, int height
for (int h=0;h<mip_height;++h)
{
int start_offset = initial_offset + line_width * h + line_offset;
memcpy(mipdata + mip_line_width*h, indata + start_offset, mip_line_width);
memcpy(mipdata + mip_line_width*h, indata + start_offset, mip_line_width); /* Flawfinder: ignore */
}
}

View File

@ -335,7 +335,12 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )
// Double the buffer size;
S32 new_buffer_size = self->mOutputBufferSize * 2;
U8* new_buffer = new U8[ new_buffer_size ];
memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize );
if (!new_buffer)
{
llerrs << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )" << llendl;
return FALSE;
}
memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); /* Flawfinder: ignore */
delete[] self->mOutputBuffer;
self->mOutputBuffer = new_buffer;
@ -359,7 +364,7 @@ void LLImageJPEG::encodeTermDestination( j_compress_ptr cinfo )
S32 file_bytes = (S32)(self->mOutputBufferSize - cinfo->dest->free_in_buffer);
self->allocateData(file_bytes);
memcpy( self->getData(), self->mOutputBuffer, file_bytes );
memcpy( self->getData(), self->mOutputBuffer, file_bytes ); /* Flawfinder: ignore */
}
// static
@ -416,7 +421,7 @@ void LLImageJPEG::errorEmitMessage( j_common_ptr cinfo, int msg_level )
void LLImageJPEG::errorOutputMessage( j_common_ptr cinfo )
{
// Create the message
char buffer[JMSG_LENGTH_MAX];
char buffer[JMSG_LENGTH_MAX]; /* Flawfinder: ignore */
(*cinfo->err->format_message) (cinfo, buffer);
((LLImageJPEG*) cinfo->client_data)->setLastError( buffer );

View File

@ -183,7 +183,7 @@ BOOL LLImageTGA::updateData()
// discard the ID field, if any
if (mIDLength)
{
memcpy(junk, getData()+mDataOffset, mIDLength);
memcpy(junk, getData()+mDataOffset, mIDLength); /* Flawfinder: ignore */
mDataOffset += mIDLength;
}
@ -220,7 +220,12 @@ BOOL LLImageTGA::updateData()
if ( (1 == mImageType) || (9 == mImageType) )
{
mColorMap = new U8[ color_map_bytes ];
memcpy( mColorMap, getData() + mDataOffset, color_map_bytes );
if (!mColorMap)
{
llerrs << "Out of Memory in BOOL LLImageTGA::updateData()" << llendl;
return FALSE;
}
memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */
}
mDataOffset += color_map_bytes;
@ -432,7 +437,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu
}
else if (getComponents() == 1)
{
memcpy(dst, src, pixels);
memcpy(dst, src, pixels); /* Flawfinder: ignore */
}
return TRUE;
@ -673,7 +678,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time)
switch( getComponents() )
{
case 1:
memcpy( dst, src, bytes_per_pixel * pixels );
memcpy( dst, src, bytes_per_pixel * pixels ); /* Flawfinder: ignore */
break;
case 2:
@ -1053,7 +1058,7 @@ bool LLImageTGA::loadFile( const LLString& path )
return false;
}
FILE *file = LLFile::fopen(path.c_str(), "rb");
FILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */
if( !file )
{
llwarns << "Couldn't open file " << path << llendl;

View File

@ -303,16 +303,16 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
keyword[0] = '\0';
valuestr[0] = '\0';
while(input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
if(!keyword)
{
continue;
@ -341,7 +341,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254[^|]",
keyword, valuestr);
mName.assign(valuestr);
LLString::replaceNonstandardASCII(mName, ' ');
LLString::replaceChar(mName, '|', ' ');
@ -361,7 +364,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented...
BOOL LLInventoryObject::exportFile(FILE* fp, BOOL) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
fprintf(fp, "\tinv_object\t0\n\t{\n");
mUUID.toString(uuid_str);
fprintf(fp, "\t\tobj_id\t%s\n", uuid_str);
@ -375,7 +378,7 @@ BOOL LLInventoryObject::exportFile(FILE* fp, BOOL) const
BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
output_stream << "\tinv_object\t0\n\t{\n";
mUUID.toString(uuid_str);
output_stream << "\t\tobj_id\t" << uuid_str << "\n";
@ -628,12 +631,12 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
mSaleInfo.unpackMultiMessage(msg, block, block_num);
char name[DB_INV_ITEM_NAME_BUF_SIZE];
char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */
msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num);
mName.assign(name);
LLString::replaceNonstandardASCII(mName, ' ');
char desc[DB_INV_ITEM_DESC_BUF_SIZE];
char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */
msg->getStringFast(block, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, block_num);
mDescription.assign(desc);
LLString::replaceNonstandardASCII(mDescription, ' ');
@ -666,10 +669,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
{
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char junk[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
char junk[MAX_STRING]; /* Flawfinder: ignore */
BOOL success = TRUE;
keyword[0] = '\0';
@ -680,7 +683,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
while(success && (!feof(fp)))
{
fgets(buffer, MAX_STRING, fp);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
if(!keyword)
{
continue;
@ -754,7 +757,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s%254[\t]%254[^|]",
keyword, junk, valuestr);
// IW: sscanf chokes and puts | in valuestr if there's no name
if (valuestr[0] == '|')
@ -770,7 +776,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s%254[\t]%254[^|]",
keyword, junk, valuestr);
if (valuestr[0] == '|')
{
@ -812,7 +821,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
fprintf(fp, "\tinv_item\t0\n\t{\n");
mUUID.toString(uuid_str);
fprintf(fp, "\t\titem_id\t%s\n", uuid_str);
@ -862,10 +871,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
{
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char junk[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
char junk[MAX_STRING]; /* Flawfinder: ignore */
BOOL success = TRUE;
keyword[0] = '\0';
@ -876,7 +885,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
while(success && input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254s",
keyword, valuestr);
if(!keyword)
{
continue;
@ -950,7 +962,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s%254[\t]%254[^|]",
keyword, junk, valuestr);
// IW: sscanf chokes and puts | in valuestr if there's no name
if (valuestr[0] == '|')
@ -966,7 +981,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s%254[\t]%254[^|]",
keyword, junk, valuestr);
if (valuestr[0] == '|')
{
@ -1008,7 +1026,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
output_stream << "\tinv_item\t0\n\t{\n";
mUUID.toString(uuid_str);
output_stream << "\t\titem_id\t" << uuid_str << "\n";
@ -1045,8 +1063,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
if(inv_type_str)
output_stream << "\t\tinv_type\t" << inv_type_str << "\n";
char buffer[32];
sprintf(buffer, "\t\tflags\t%08x\n", mFlags);
char buffer[32]; /* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), "\t\tflags\t%08x\n", mFlags); /* Flawfinder: ignore */
output_stream << buffer;
mSaleInfo.exportLegacyStream(output_stream);
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
@ -1316,18 +1334,18 @@ S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_overri
// describe the inventory item
char* buffer = (char*) bin_bucket;
char creator_id_str[UUID_STR_LENGTH];
char creator_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
perm.getCreator().toString(creator_id_str);
char owner_id_str[UUID_STR_LENGTH];
char owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
perm.getOwner().toString(owner_id_str);
char last_owner_id_str[UUID_STR_LENGTH];
char last_owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
perm.getLastOwner().toString(last_owner_id_str);
char group_id_str[UUID_STR_LENGTH];
char group_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
perm.getGroup().toString(group_id_str);
char asset_id_str[UUID_STR_LENGTH];
char asset_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
getAssetUUID().toString(asset_id_str);
S32 size = sprintf(buffer,
S32 size = sprintf(buffer, /* Flawfinder: ignore */
"%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x",
getType(),
getInventoryType(),
@ -1357,7 +1375,15 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
// Convert the bin_bucket into a string.
char* item_buffer = new char[bin_bucket_size+1];
memcpy(item_buffer, bin_bucket, bin_bucket_size);
if ((item_buffer != NULL) && (bin_bucket != NULL))
{
memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
}
else
{
llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
return;
}
item_buffer[bin_bucket_size] = '\0';
std::string str(item_buffer);
@ -1500,7 +1526,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
S8 type;
msg->getS8Fast(block, _PREHASH_Type, type, block_num);
mPreferredType = static_cast<LLAssetType::EType>(type);
char name[DB_INV_ITEM_NAME_BUF_SIZE];
char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */
msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num);
mName.assign(name);
LLString::replaceNonstandardASCII(mName, ' ');
@ -1511,16 +1537,19 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
{
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
keyword[0] = '\0';
valuestr[0] = '\0';
while(!feof(fp))
{
fgets(buffer, MAX_STRING, fp);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254s",
keyword, valuestr);
if(!keyword)
{
continue;
@ -1553,7 +1582,10 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254[^|]",
keyword, valuestr);
mName.assign(valuestr);
LLString::replaceNonstandardASCII(mName, ' ');
LLString::replaceChar(mName, '|', ' ');
@ -1569,7 +1601,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
fprintf(fp, "\tinv_category\t0\n\t{\n");
mUUID.toString(uuid_str);
fprintf(fp, "\t\tcat_id\t%s\n", uuid_str);
@ -1588,16 +1620,19 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
{
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
keyword[0] = '\0';
valuestr[0] = '\0';
while(input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254s",
keyword, valuestr);
if(!keyword)
{
continue;
@ -1630,7 +1665,10 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
{
//strcpy(valuestr, buffer + strlen(keyword) + 3);
// *NOTE: Not ANSI C, but widely supported.
sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254[^|]",
keyword, valuestr);
mName.assign(valuestr);
LLString::replaceNonstandardASCII(mName, ' ');
LLString::replaceChar(mName, '|', ' ');
@ -1646,7 +1684,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const
{
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
output_stream << "\tinv_category\t0\n\t{\n";
mUUID.toString(uuid_str);
output_stream << "\t\tcat_id\t" << uuid_str << "\n";

View File

@ -121,10 +121,13 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer)
{
// *NOTE: Changing the buffer size will require changing the
// scanf call below.
char region_id_str[MAX_STRING];
char region_id_str[MAX_STRING]; /* Flawfinder: ignore */
LLVector3 pos;
cur += chars_read;
count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read);
count = sscanf( /* Flawfinder: ignore */
cur,
"region_id %254s\n%n",
region_id_str, &chars_read);
if(count != 1) goto error;
cur += chars_read;
count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read);

View File

@ -170,7 +170,7 @@ bool LLNotecard::importStream(std::istream& str)
return FALSE;
}
char line_buf[STD_STRING_BUF_SIZE];
char line_buf[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */
str.getline(line_buf, STD_STRING_BUF_SIZE);
if(str.fail())
{

View File

@ -998,7 +998,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr
BOOL LLParcel::exportStream(std::ostream& output_stream)
{
S32 setting;
char id_string[MAX_STRING];
char id_string[MAX_STRING]; /* Flawfinder: ignore */
std::ios::fmtflags old_flags = output_stream.flags();
output_stream.setf(std::ios::showpoint);
@ -1229,7 +1229,7 @@ void LLParcel::packMessage(LLMessageSystem* msg)
void LLParcel::unpackMessage(LLMessageSystem* msg)
{
char buffer[256];
char buffer[256]; /* Flawfinder: ignore */
msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags );
msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice );

View File

@ -487,18 +487,18 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b
// File support
//
BOOL LLPermissions::importFile(FILE *fp)
BOOL LLPermissions::importFile(FILE* fp)
{
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
const S32 BUFSIZE = 16384;
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[BUFSIZE];
char keyword[256];
char valuestr[256];
char uuid_str[256];
U32 mask;
char buffer[BUFSIZE]; /* Flawfinder: ignore */
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
char uuid_str[256]; /* Flawfinder: ignore */
U32 mask;
keyword[0] = '\0';
valuestr[0] = '\0';
@ -506,7 +506,10 @@ BOOL LLPermissions::importFile(FILE *fp)
while (!feof(fp))
{
fgets(buffer, BUFSIZE, fp);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword, valuestr);
if (!keyword)
{
continue;
@ -554,22 +557,22 @@ BOOL LLPermissions::importFile(FILE *fp)
}
else if (!strcmp("creator_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mCreator.set(uuid_str);
}
else if (!strcmp("owner_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mOwner.set(uuid_str);
}
else if (!strcmp("last_owner_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mLastOwner.set(uuid_str);
}
else if (!strcmp("group_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mGroup.set(uuid_str);
}
else if (!strcmp("group_owned", keyword))
@ -588,9 +591,9 @@ BOOL LLPermissions::importFile(FILE *fp)
}
BOOL LLPermissions::exportFile(FILE *fp) const
BOOL LLPermissions::exportFile(FILE* fp) const
{
char uuid_str[256];
char uuid_str[256]; /* Flawfinder: ignore */
fprintf(fp, "\tpermissions 0\n");
fprintf(fp, "\t{\n");
@ -629,11 +632,11 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[BUFSIZE];
char keyword[256];
char valuestr[256];
char uuid_str[256];
U32 mask;
char buffer[BUFSIZE]; /* Flawfinder: ignore */
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
char uuid_str[256]; /* Flawfinder: ignore */
U32 mask;
keyword[0] = '\0';
valuestr[0] = '\0';
@ -641,7 +644,10 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
while (input_stream.good())
{
input_stream.getline(buffer, BUFSIZE);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword, valuestr);
if (!keyword)
{
continue;
@ -689,22 +695,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
}
else if (!strcmp("creator_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mCreator.set(uuid_str);
}
else if (!strcmp("owner_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mOwner.set(uuid_str);
}
else if (!strcmp("last_owner_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mLastOwner.set(uuid_str);
}
else if (!strcmp("group_id", keyword))
{
sscanf(valuestr, "%255s", uuid_str);
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
mGroup.set(uuid_str);
}
else if (!strcmp("group_owned", keyword))
@ -725,21 +731,21 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const
{
char uuid_str[256];
char uuid_str[256]; /* Flawfinder: ignore */
output_stream << "\tpermissions 0\n";
output_stream << "\t{\n";
char buffer[256];
sprintf(buffer, "\t\tbase_mask\t%08x\n", mMaskBase);
char buffer[256]; /* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n", mMaskBase); /* Flawfinder: ignore */
output_stream << buffer;
sprintf(buffer, "\t\towner_mask\t%08x\n", mMaskOwner);
snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n", mMaskOwner); /* Flawfinder: ignore */
output_stream << buffer;
sprintf(buffer, "\t\tgroup_mask\t%08x\n", mMaskGroup);
snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n", mMaskGroup); /* Flawfinder: ignore */
output_stream << buffer;
sprintf(buffer, "\t\teveryone_mask\t%08x\n", mMaskEveryone);
snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n", mMaskEveryone); /* Flawfinder: ignore */
output_stream << buffer;
sprintf(buffer, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner);
snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); /* Flawfinder: ignore */
output_stream << buffer;
mCreator.toString(uuid_str);

View File

@ -141,9 +141,9 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
BOOL success = TRUE;
keyword[0] = '\0';
@ -151,7 +151,10 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
while(success && (!feof(fp)))
{
fgets(buffer, MAX_STRING, fp);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254s",
keyword, valuestr);
if(!keyword)
{
continue;
@ -194,9 +197,9 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
// *NOTE: Changing the buffer size will require changing the scanf
// calls below.
char buffer[MAX_STRING];
char keyword[MAX_STRING];
char valuestr[MAX_STRING];
char buffer[MAX_STRING]; /* Flawfinder: ignore */
char keyword[MAX_STRING]; /* Flawfinder: ignore */
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
BOOL success = TRUE;
keyword[0] = '\0';
@ -204,7 +207,10 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
while(success && input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %254s %254s",
keyword, valuestr);
if(!keyword)
{
continue;

View File

@ -102,25 +102,25 @@ void LLCamera::setFar(F32 far_plane)
size_t LLCamera::writeFrustumToBuffer(char *buffer) const
{
memcpy(buffer, &mView, sizeof(F32));
memcpy(buffer, &mView, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(buffer, &mAspect, sizeof(F32));
memcpy(buffer, &mAspect, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(buffer, &mNearPlane, sizeof(F32));
memcpy(buffer, &mNearPlane, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(buffer, &mFarPlane, sizeof(F32));
memcpy(buffer, &mFarPlane, sizeof(F32)); /* Flawfinder: ignore */
return 4*sizeof(F32);
}
size_t LLCamera::readFrustumFromBuffer(const char *buffer)
{
memcpy(&mView, buffer, sizeof(F32));
memcpy(&mView, buffer, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(&mAspect, buffer, sizeof(F32));
memcpy(&mAspect, buffer, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(&mNearPlane, buffer, sizeof(F32));
memcpy(&mNearPlane, buffer, sizeof(F32)); /* Flawfinder: ignore */
buffer += sizeof(F32);
memcpy(&mFarPlane, buffer, sizeof(F32));
memcpy(&mFarPlane, buffer, sizeof(F32)); /* Flawfinder: ignore */
return 4*sizeof(F32);
}

View File

@ -441,26 +441,26 @@ void LLCoordFrame::getRotMatrixToParent(LLMatrix4& mat) const
size_t LLCoordFrame::writeOrientation(char *buffer) const
{
memcpy(buffer, mOrigin.mV, 3*sizeof(F32));
memcpy(buffer, mOrigin.mV, 3*sizeof(F32)); /*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(buffer, mXAxis.mV, 3*sizeof(F32));
memcpy(buffer, mXAxis.mV, 3*sizeof(F32)); /*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(buffer, mYAxis.mV, 3*sizeof(F32));
memcpy(buffer, mYAxis.mV, 3*sizeof(F32));/*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(buffer, mZAxis.mV, 3*sizeof(F32));
memcpy(buffer, mZAxis.mV, 3*sizeof(F32)); /*Flawfinder: ignore */
return 12*sizeof(F32);
}
size_t LLCoordFrame::readOrientation(const char *buffer)
{
memcpy(mOrigin.mV, buffer, 3*sizeof(F32));
memcpy(mOrigin.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(mXAxis.mV, buffer, 3*sizeof(F32));
memcpy(mXAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(mYAxis.mV, buffer, 3*sizeof(F32));
memcpy(mYAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */
buffer += 3*sizeof(F32);
memcpy(mZAxis.mV, buffer, 3*sizeof(F32));
memcpy(mZAxis.mV, buffer, 3*sizeof(F32)); /*Flawfinder: ignore */
if( !isFinite() )
{

View File

@ -705,11 +705,11 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split)
BOOL LLProfileParams::importFile(FILE *fp)
{
const S32 BUFSIZE = 16384;
char buffer[BUFSIZE];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
// *NOTE: changing the size or type of these buffers will require
// changing the sscanf below.
char keyword[256];
char valuestr[256];
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
keyword[0] = 0;
valuestr[0] = 0;
F32 tempF32;
@ -718,7 +718,10 @@ BOOL LLProfileParams::importFile(FILE *fp)
while (!feof(fp))
{
fgets(buffer, BUFSIZE, fp);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword, valuestr);
if (!keyword)
{
continue;
@ -777,11 +780,11 @@ BOOL LLProfileParams::exportFile(FILE *fp) const
BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)
{
const S32 BUFSIZE = 16384;
char buffer[BUFSIZE];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
// *NOTE: changing the size or type of these buffers will require
// changing the sscanf below.
char keyword[256];
char valuestr[256];
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
keyword[0] = 0;
valuestr[0] = 0;
F32 tempF32;
@ -790,7 +793,11 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)
while (input_stream.good())
{
input_stream.getline(buffer, BUFSIZE);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword,
valuestr);
if (!keyword)
{
continue;
@ -1199,11 +1206,11 @@ BOOL LLDynamicPath::generate(F32 detail, S32 split)
BOOL LLPathParams::importFile(FILE *fp)
{
const S32 BUFSIZE = 16384;
char buffer[BUFSIZE];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
// *NOTE: changing the size or type of these buffers will require
// changing the sscanf below.
char keyword[256];
char valuestr[256];
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
keyword[0] = 0;
valuestr[0] = 0;
@ -1214,7 +1221,10 @@ BOOL LLPathParams::importFile(FILE *fp)
while (!feof(fp))
{
fgets(buffer, BUFSIZE, fp);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword, valuestr);
if (!keyword)
{
continue;
@ -1340,11 +1350,11 @@ BOOL LLPathParams::exportFile(FILE *fp) const
BOOL LLPathParams::importLegacyStream(std::istream& input_stream)
{
const S32 BUFSIZE = 16384;
char buffer[BUFSIZE];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
// *NOTE: changing the size or type of these buffers will require
// changing the sscanf below.
char keyword[256];
char valuestr[256];
char keyword[256]; /* Flawfinder: ignore */
char valuestr[256]; /* Flawfinder: ignore */
keyword[0] = 0;
valuestr[0] = 0;
@ -1355,7 +1365,10 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream)
while (input_stream.good())
{
input_stream.getline(buffer, BUFSIZE);
sscanf(buffer, " %255s %255s", keyword, valuestr);
sscanf( /* Flawfinder: ignore */
buffer,
" %255s %255s",
keyword, valuestr);
if (!keyword)
{
continue;
@ -2166,7 +2179,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const
size_s_out = getProfile().getTotalOut();
size_t = getPath().mPath.size();
if (open)
if (open) /* Flawfinder: ignore */
{
if (hollow)
{
@ -2788,7 +2801,7 @@ noindices:
return NULL;
}
num_indices = count;
memcpy(indices, index, count * sizeof(S32));
memcpy(indices, index, count * sizeof(S32)); /* Flawfinder: ignore */
return indices;
}
@ -3291,7 +3304,7 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
*output_triangles = new S32[cur_tri*3];
num_output_triangles = cur_tri;
memcpy(*output_triangles, sorted_tris, 3*cur_tri*sizeof(S32));
memcpy(*output_triangles, sorted_tris, 3*cur_tri*sizeof(S32)); /* Flawfinder: ignore */
/*
llinfos << "Out vertices: " << num_output_vertices << llendl;
@ -3328,16 +3341,16 @@ BOOL LLVolumeParams::importFile(FILE *fp)
{
//llinfos << "importing volume" << llendl;
const S32 BUFSIZE = 16384;
char buffer[BUFSIZE];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
// *NOTE: changing the size or type of this buffer will require
// changing the sscanf below.
char keyword[256];
char keyword[256]; /* Flawfinder: ignore */
keyword[0] = 0;
while (!feof(fp))
{
fgets(buffer, BUFSIZE, fp);
sscanf(buffer, " %255s", keyword);
sscanf(buffer, " %255s", keyword); /* Flawfinder: ignore */
if (!keyword)
{
continue;
@ -3384,8 +3397,8 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)
const S32 BUFSIZE = 16384;
// *NOTE: changing the size or type of this buffer will require
// changing the sscanf below.
char buffer[BUFSIZE];
char keyword[256];
char buffer[BUFSIZE]; /* Flawfinder: ignore */
char keyword[256]; /* Flawfinder: ignore */
keyword[0] = 0;
while (input_stream.good())

View File

@ -267,7 +267,7 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail)
F32 LLVolumeLODGroup::dump()
{
char dump_str[255];
char dump_str[255]; /* Flawfinder: ignore */
F32 usage = 0.f;
for (S32 i = 0; i < NUM_LODS; i++)
{
@ -278,7 +278,7 @@ F32 LLVolumeLODGroup::dump()
}
usage = usage / (F32)NUM_LODS;
sprintf(dump_str, "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]);
snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */
llinfos << dump_str << llendl;
return usage;

View File

@ -147,7 +147,7 @@ inline LLColor3::LLColor3(const F32 *vec)
inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF
{
if (strlen(color_string) < 6)
if (strlen(color_string) < 6) /* Flawfinder: ignore */
{
mV[0] = 0.f;
mV[1] = 0.f;
@ -155,8 +155,8 @@ inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGB
return;
}
static char tempstr[7];
strncpy(tempstr,color_string,6);
static char tempstr[7]; /* Flawfinder: ignore */
strncpy(tempstr,color_string,6); /* Flawfinder: ignore */
tempstr[6] = '\0';
mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f;
tempstr[4] = '\0';

View File

@ -1037,12 +1037,12 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss
uuid.toString(uuid_str);
snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */
FILE *fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
FILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
if (fp)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size))
while (file.read(copy_buf, buf_size)) /* Flawfinder: ignore */
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{

View File

@ -90,7 +90,7 @@ LLHeapBuffer::LLHeapBuffer(const U8* src, S32 len)
allocate(len);
if(mBuffer)
{
memcpy(mBuffer, src, len);
memcpy(mBuffer, src, len); /*Flawfinder: ignore*/
}
}
else
@ -716,7 +716,7 @@ bool LLBufferArray::copyIntoBuffers(
}
segments.push_back(segment);
S32 bytes = llmin(segment.size(), len);
memcpy(segment.data(), src + copied, bytes); /* Flawfinder Ignore */
memcpy(segment.data(), src + copied, bytes); /* Flawfinder: Ignore */
copied += bytes;
len -= bytes;
if(0 == len)
@ -738,7 +738,7 @@ bool LLBufferArray::copyIntoBuffers(
return false;
}
segments.push_back(segment);
memcpy(segment.data(), src + copied, segment.size());
memcpy(segment.data(), src + copied, segment.size()); /*Flawfinder: ignore*/
copied += segment.size();
len -= segment.size();
}

View File

@ -278,7 +278,10 @@ void LLCacheName::importFile(FILE* fp)
// *NOTE: This buffer size is hardcoded into sscanf() below
char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/
S32 version = 0;
S32 match = sscanf(buffer, "%1023s %d", version_string, &version);
S32 match = sscanf( /* Flawfinder: ignore */
buffer,
"%1023s %d",
version_string, &version);
if ( match != 2
|| strcmp(version_string, "version")
|| version != CN_FILE_VERSION)
@ -297,7 +300,7 @@ void LLCacheName::importFile(FILE* fp)
valid = fgets(buffer, BUFFER_SIZE, fp);
if (!valid) break;
match = sscanf(
match = sscanf( /* Flawfinder: ignore */
buffer,
"%254s %u %254s %254s",
id_string,
@ -376,7 +379,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
{
// The function signature needs to change to pass in the
// length of first and last.
strcpy(first, CN_NOBODY);
strcpy(first, CN_NOBODY); /*Flawfinder: ignore*/
last[0] = '\0';
return FALSE;
}
@ -386,8 +389,8 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
{
// The function signature needs to change to pass in the
// length of first and last.
strcpy(first, entry->mFirstName);
strcpy(last, entry->mLastName);
strcpy(first, entry->mFirstName); /*Flawfinder: ignore*/
strcpy(last, entry->mLastName); /*Flawfinder: ignore*/
return TRUE;
}
else
@ -397,7 +400,7 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
strcpy(first,(ll_frand() < HIPPO_PROBABILITY)
? CN_HIPPOS
: CN_WAITING);
strcpy(last, "");
strcpy(last, ""); /*Flawfinder: ignore*/
impl.mAskNameQueue.push_back(id);
return FALSE;
@ -413,7 +416,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
{
// The function signature needs to change to pass in the
// length of first and last.
strcpy(group, CN_NONE);
strcpy(group, CN_NONE); /*Flawfinder: ignore*/
return FALSE;
}
@ -431,14 +434,14 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
{
// The function signature needs to change to pass in the length
// of group.
strcpy(group, entry->mGroupName);
strcpy(group, entry->mGroupName); /*Flawfinder: ignore*/
return TRUE;
}
else
{
// The function signature needs to change to pass in the length
// of first and last.
strcpy(group, CN_WAITING);
strcpy(group, CN_WAITING); /*Flawfinder: ignore*/
impl.mAskGroupQueue.push_back(id);
return FALSE;

View File

@ -524,7 +524,7 @@ const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLData
// We've got problems, ack!
llerrs << "Trying to do an assignment with not enough room in the target." << llendl;
}
memcpy(mBufferp, a.mBufferp, a.getBufferSize());
memcpy(mBufferp, a.mBufferp, a.getBufferSize()); /*Flawfinder: ignore*/
return *this;
}
@ -1217,7 +1217,7 @@ BOOL LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name)
}
char tmp_str[64]; /* Flawfinder: ignore */
sscanf(valuestr, "%63s", tmp_str);
sscanf(valuestr, "%63s", tmp_str); /* Flawfinder: ignore */
value.set(tmp_str);
return success;
@ -1239,7 +1239,7 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name)
}
else
{
numCopied = (S32)strlen(name) + 1; //name + tab /* Flawfinder: ignore */
numCopied = (S32)strlen(name) + 1; /* Flawfinder: ignore */ //name + tab
}
// snprintf returns number of bytes that would have been written had the
@ -1269,9 +1269,9 @@ BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32
// Read both the name and the value, and validate the name.
sscanf(mCurBufferp, "%511[^\n]", buffer);
// Skip the \n
mCurBufferp += (S32)strlen(buffer) + 1;
mCurBufferp += (S32)strlen(buffer) + 1; /* Flawfinder: ignore */
sscanf(buffer, "%511s %511[^\n]", keyword, value);
sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */
if (strcmp(keyword, name))
{
@ -1775,7 +1775,7 @@ BOOL LLDataPackerAsciiFile::unpackUUID(LLUUID &value, const char *name)
}
char tmp_str[64]; /*Flawfinder: ignore */
sscanf(valuestr,"%63s",tmp_str);
sscanf(valuestr,"%63s",tmp_str); /* Flawfinder: ignore */
value.set(tmp_str);
return success;
@ -1819,7 +1819,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
fgetpos(mFP, &last_pos);
fgets(buffer, DP_BUFSIZE, mFP);
sscanf(buffer, "%511s %511[^\n]", keyword, value);
sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */
if (!keyword[0])
{
@ -1844,7 +1844,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
{
mInputStream->getline(buffer, DP_BUFSIZE);
sscanf(buffer, "%511s %511[^\n]", keyword, value);
sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */
if (!keyword[0])
{
llwarns << "Data packer could not get the keyword!" << llendl;

View File

@ -68,7 +68,7 @@ void LLHost::getIPString(char* buffer, S32 length) const
std::string LLHost::getIPandPort() const
{
char buffer[MAXADDRSTR + 1 + 5];
char buffer[MAXADDRSTR + 1 + 5]; /*Flawfinder: ignore*/
getString(buffer, sizeof(buffer));
return buffer;
}

View File

@ -99,7 +99,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uu
mURLBuffer = new char[strlen(url) + 1]; /*Flawfinder: ignore*/
if (mURLBuffer)
{
strcpy(mURLBuffer, url);
strcpy(mURLBuffer, url); /*Flawfinder: ignore*/
}
}

View File

@ -207,8 +207,8 @@ void pack_instant_message_block(
S32 bytes_left = MTUBYTES;
if(message)
{
char buffer[MTUBYTES];
bytes_left -= snprintf(buffer, MTUBYTES, "%s", message);
char buffer[MTUBYTES]; /*Flawfinder: ignore*/
bytes_left -= snprintf(buffer, MTUBYTES, "%s", message); /*Flawfinder: ignore*/
bytes_left = llmax(0, bytes_left);
msg->addStringFast(_PREHASH_Message, buffer);
}
@ -244,11 +244,11 @@ void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg)
mIMType = (EInstantMessage) dialog;
msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID);
msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp);
char name[DB_FULL_NAME_BUF_SIZE];
char name[DB_FULL_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name);
mName.assign(name);
char message[DB_IM_MSG_BUF_SIZE];
char message[DB_IM_MSG_BUF_SIZE]; /*Flawfinder: ignore*/
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message);
mMessage.assign(message);

View File

@ -40,7 +40,7 @@ user_callback_map_t gUserCallbackMap;
LLStringTable gNVNameTable(16384);
char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] =
char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] = /*Flawfinder: Ignore*/
{
"NULL",
"STRING",
@ -51,17 +51,17 @@ char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] =
"CAMERA", // Deprecated, but leaving in case removing completely would cause problems
"ASSET",
"U64"
}; /*Flawfinder: Ignore*/
};
char NameValueClassStrings[NVC_EOF][NAME_VALUE_CLASS_STRING_LENGTH] =
char NameValueClassStrings[NVC_EOF][NAME_VALUE_CLASS_STRING_LENGTH] = /*Flawfinder: Ignore*/
{
"NULL",
"R", // read only
"RW", // read write
"CB" // callback
}; /*Flawfinder: Ignore*/
};
char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] =
char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] = /*Flawfinder: Ignore*/
{
"NULL",
"S", // "Sim", formerly SIM
@ -393,11 +393,11 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass
LLNameValue::LLNameValue(const char *data)
{
baseInit();
static char name[NV_BUFFER_LEN];
static char type[NV_BUFFER_LEN];
static char nvclass[NV_BUFFER_LEN];
static char nvsendto[NV_BUFFER_LEN];
static char nvdata[NV_BUFFER_LEN];
static char name[NV_BUFFER_LEN]; /*Flawfinder: ignore*/
static char type[NV_BUFFER_LEN]; /*Flawfinder: ignore*/
static char nvclass[NV_BUFFER_LEN]; /*Flawfinder: ignore*/
static char nvsendto[NV_BUFFER_LEN]; /*Flawfinder: ignore*/
static char nvdata[NV_BUFFER_LEN]; /*Flawfinder: ignore*/
S32 i;
@ -421,7 +421,7 @@ LLNameValue::LLNameValue(const char *data)
}
// read in the name
sscanf((data + character_count), "%2047s", name);
sscanf((data + character_count), "%2047s", name); /*Flawfinder: ignore*/
// bump past it and add null terminator
length = (S32)strlen(name); /* Flawfinder: ignore */
@ -445,7 +445,7 @@ LLNameValue::LLNameValue(const char *data)
}
// read in the type
sscanf((data + character_count), "%2047s", type);
sscanf((data + character_count), "%2047s", type); /*Flawfinder: ignore*/
// bump past it and add null terminator
length = (S32)strlen(type); /* Flawfinder: ignore */
@ -481,7 +481,7 @@ LLNameValue::LLNameValue(const char *data)
{
// yes we do!
// read in the class
sscanf((data + character_count), "%2047s", nvclass);
sscanf((data + character_count), "%2047s", nvclass); /*Flawfinder: ignore*/
// bump past it and add null terminator
length = (S32)strlen(nvclass); /* Flawfinder: ignore */
@ -523,7 +523,7 @@ LLNameValue::LLNameValue(const char *data)
if (i != NVS_EOF)
{
// found a sendto argument
sscanf((data + character_count), "%2047s", nvsendto);
sscanf((data + character_count), "%2047s", nvsendto); /*Flawfinder: ignore*/
// add null terminator
length = (S32)strlen(nvsendto); /* Flawfinder: ignore */

View File

@ -111,7 +111,7 @@ public:
mBuffer = new U8[buf_len];
if (mBuffer != NULL)
{
memcpy(mBuffer,buf_ptr,buf_len);
memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/
mBufferLength = buf_len;
}

View File

@ -25,7 +25,7 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32
if (datap != NULL)
{
memcpy(mData, datap, size);
memcpy(mData, datap, size); /*Flawfinder: ignore*/
mSize = size;
}

View File

@ -113,7 +113,7 @@ S32 LLPacketRing::receiveFromRing (S32 socket, char *datap)
packet_size = packetp->getSize();
if (packetp->getData() != NULL)
{
memcpy(datap, packetp->getData(), packet_size);
memcpy(datap, packetp->getData(), packet_size); /*Flawfinder: ignore*/
}
// need to set sender IP/port!!
mLastSender = packetp->getHost();

View File

@ -346,7 +346,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
{
if ((packetp->mDatap != NULL) && (size<(S32)sizeof(tmp_data)))
{
memcpy(tmp_data, packetp->mDatap, size);
memcpy(tmp_data, packetp->mDatap, size); /*Flawfinder: ignore*/
}
}
status = packetp->mStatus;
@ -519,7 +519,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
{
if ((packetp->mDatap != NULL) && (size<(S32)sizeof(tmp_data)))
{
memcpy(tmp_data, packetp->mDatap, size);
memcpy(tmp_data, packetp->mDatap, size); /*Flawfinder: ignore*/
}
}
status = packetp->mStatus;
@ -1157,7 +1157,7 @@ LLTransferPacket::LLTransferPacket(const S32 packet_id, const LLTSCode status, c
mDatap = new U8[size];
if (mDatap != NULL)
{
memcpy(mDatap, datap, size);
memcpy(mDatap, datap, size); /*Flawfinder: ignore*/
}
}

View File

@ -116,7 +116,7 @@ S32 LLXfer::receiveData (char *datap, S32 data_size)
{
if (datap != NULL)
{
memcpy(&mBuffer[mBufferLength],datap,data_size);
memcpy(&mBuffer[mBufferLength],datap,data_size); /*Flawfinder: ignore*/
mBufferLength += data_size;
}
else
@ -193,7 +193,7 @@ void LLXfer::sendPacket(S32 packet_num)
num_copy = llmin(num_copy, (S32)(mBufferLength - desired_read_position));
if (num_copy > 0)
{
memcpy(fdata_buf,&mBuffer[desired_read_position],num_copy);
memcpy(fdata_buf,&mBuffer[desired_read_position],num_copy); /*Flawfinder: ignore*/
}
}
else
@ -206,7 +206,7 @@ void LLXfer::sendPacket(S32 packet_num)
(S32)(mBufferLength - desired_read_position));
if (num_copy > 0)
{
memcpy(
memcpy( /*Flawfinder: ignore*/
fdata_buf + sizeof(S32),
&mBuffer[desired_read_position],
num_copy);

View File

@ -394,8 +394,8 @@ U32 LLXfer_File::getXferTypeTag()
S32 copy_file(const char* from, const char* to)
{
S32 rv = 0;
FILE* in = LLFile::fopen(from, "rb");
FILE* out = LLFile::fopen(to, "wb");
FILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/
FILE* out = LLFile::fopen(to, "wb"); /*Flawfinder: ignore*/
if(in && out)
{
S32 read = 0;

View File

@ -968,7 +968,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
LLMessageVariable var;
char var_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */
char formatString[MAX_MESSAGE_INTERNAL_NAME_SIZE];
char formatString[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */
FILE* messagefilep = NULL;
mMessageFileChecksum = 0;
@ -976,14 +976,19 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
S32 checksum_offset = 0;
char* checkp = NULL;
snprintf(formatString, sizeof(formatString), "%%%ds", MAX_MESSAGE_INTERNAL_NAME_SIZE);
messagefilep = LLFile::fopen(filename, "r");
// scanf needs 1 byte more than width, thus the MAX_... -1.
snprintf( /* Flawfinder: ignore */
formatString,
sizeof(formatString),
"%%%ds",
MAX_MESSAGE_INTERNAL_NAME_SIZE - 1);
messagefilep = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
if (messagefilep)
{
// mName = gMessageStringTable.getString(filename);
fseek(messagefilep, 0L, SEEK_SET );
while(fscanf(messagefilep, formatString, token) != EOF)
while(fscanf(messagefilep, formatString, token) != EOF) /* Flawfinder: ignore */
{
// skip comments
if (token[0] == '/')
@ -1113,7 +1118,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
b_template = FALSE;
// name first
if (fscanf(messagefilep, formatString, template_name) == EOF)
if (fscanf(messagefilep, formatString, template_name) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected message template name, but file ended"
@ -1145,7 +1150,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
}
// ok, now get Frequency ("High", "Medium", or "Low")
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected message template frequency, found EOF."
@ -1226,7 +1231,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
else if (!strcmp(token, "Fixed"))
{
U32 message_num = 0;
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected message template number (fixed),"
@ -1260,7 +1265,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
}
// Now get trust ("Trusted", "NotTrusted")
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// File ended
llerrs << "Expected message template "
@ -1297,7 +1302,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
}
// get encoding
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// File ended
llerrs << "Expected message encoding, but file ended."
@ -1343,7 +1348,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
// ok, need to pull header info
// name first
if (fscanf(messagefilep, formatString, block_name) == EOF)
if (fscanf(messagefilep, formatString, block_name) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected block name, but file ended" << llendl;
@ -1371,7 +1376,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
}
// now, block type ("Single", "Multiple", or "Variable")
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected block type, but file ended." << llendl;
@ -1396,7 +1401,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
else if (!strcmp(token, "Multiple"))
{
// need to get the number of repeats
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected block multiple count,"
@ -1452,7 +1457,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
// ok, need to pull header info
// name first
if (fscanf(messagefilep, formatString, var_name) == EOF)
if (fscanf(messagefilep, formatString, var_name) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected variable name, but file ended."
@ -1481,7 +1486,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
}
// now, variable type ("Fixed" or "Variable")
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected variable type, but file ended"
@ -1575,7 +1580,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
else if (!strcmp(token, "Fixed"))
{
// need to get the variable size
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected variable size, but file ended"
@ -1608,7 +1613,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
else if (!strcmp(token, "Variable"))
{
// need to get the variable size
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected variable size, but file ended"
@ -1657,7 +1662,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
if (!strcmp(token, "version"))
{
// version number
if (fscanf(messagefilep, formatString, token) == EOF)
if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
{
// oops, file ended
llerrs << "Expected version number, but file ended"
@ -2715,7 +2720,7 @@ void LLMessageSystem::buildMessage()
temp_block_number = (U8)mbci->mBlockNumber;
if ((S32)(mSendSize + sizeof(U8)) < MAX_BUFFER_SIZE)
{
memcpy(&mSendBuffer[mSendSize], &temp_block_number, sizeof(U8));
memcpy(&mSendBuffer[mSendSize], &temp_block_number, sizeof(U8)); /* Flawfinder: ignore */
mSendSize += sizeof(U8);
}
else
@ -2792,7 +2797,7 @@ void LLMessageSystem::buildMessage()
{
if(mSendSize + mvci.getSize() < (S32)sizeof(mSendBuffer))
{
memcpy(
memcpy( /* Flawfinder: ignore */
&mSendBuffer[mSendSize],
mvci.getData(),
mvci.getSize());
@ -3058,7 +3063,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
if((S32)(buffer_length + sizeof(TPACKETID)) < MAX_BUFFER_SIZE)
{
memcpy(&buf_ptr[buffer_length], &packet_id, sizeof(TPACKETID));
memcpy(&buf_ptr[buffer_length], &packet_id, sizeof(TPACKETID)); /* Flawfinder: ignore */
// Do the accounting
buffer_length += sizeof(TPACKETID);
}
@ -3166,7 +3171,7 @@ BOOL LLMessageSystem::decodeTemplate(
// it appears that if there is a NULL in the message #, it won't copy it....
// what was the goal?
//if(header[2])
memcpy(&message_id_U16, &header[2], 2);
memcpy(&message_id_U16, &header[2], 2); /* Flawfinder: ignore */
// dependant on endian-ness:
// U32 temp = (255 << 24) | (255 << 16) | header[2];
@ -3577,7 +3582,7 @@ void LLMessageSystem::getDataFast(const char *blockname, const char *varname, vo
((U32*)datap)[1] = ((U32*)vardata.getData())[1];
break;
default:
memcpy(datap, vardata.getData(), vardata_size);
memcpy(datap, vardata.getData(), vardata_size); /* Flawfinder: ignore */
break;
}
}
@ -3589,7 +3594,7 @@ void LLMessageSystem::getDataFast(const char *blockname, const char *varname, vo
<< " but truncated to max size of " << max_size
<< llendl;
memcpy(datap, vardata.getData(), max_size);
memcpy(datap, vardata.getData(), max_size); /* Flawfinder: ignore */
}
}
@ -4456,7 +4461,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
return;
}
char their_digest[MD5HEX_STR_SIZE];
char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest);
if(size != MD5HEX_STR_BYTES)
{
@ -4536,7 +4541,7 @@ void encrypt_template(const char *src_name, const char *dest_name)
BOOL decrypt_template(const char *src_name, const char *dest_name)
{
S32 buf_length = LL_ENCRYPT_BUF_LENGTH;
char buf[LL_ENCRYPT_BUF_LENGTH];
char buf[LL_ENCRYPT_BUF_LENGTH]; /* Flawfinder: ignore */
FILE* infp = NULL;
FILE* outfp = NULL;
@ -4551,7 +4556,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
goto exit;
}
infp = LLFile::fopen(src_name,"rb");
infp = LLFile::fopen(src_name,"rb"); /* Flawfinder: ignore */
if (!infp)
{
llwarns << "could not open " << src_name << " for reading" << llendl;
@ -4564,7 +4569,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
goto exit;
}
outfp = LLFile::fopen(dest_name,"w+b");
outfp = LLFile::fopen(dest_name,"w+b"); /* Flawfinder: ignore */
if (!outfp)
{
llwarns << "could not open " << src_name << " for writing" << llendl;
@ -4599,7 +4604,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
void dump_prehash_files()
{
U32 i;
FILE *fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w");
FILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */
if (fp)
{
fprintf(
@ -4631,7 +4636,7 @@ void dump_prehash_files()
fprintf(fp, "\n\n#endif\n");
fclose(fp);
}
fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w");
fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */
if (fp)
{
fprintf(
@ -5562,7 +5567,7 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs(char* digest, const U32 nu
if( secret != NULL)
{
d.update(secret, (U32)strlen((char *) secret));
d.update(secret, (U32)strlen((char *) secret)); /* Flawfinder: ignore */
}
d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
@ -5573,13 +5578,13 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs(char* digest, const U32 nu
d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
if( (char*) id1str != NULL)
{
d.update(id1str, (U32)strlen((char *) id1str));
d.update(id1str, (U32)strlen((char *) id1str)); /* Flawfinder: ignore */
}
d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
if( (char*) id2str != NULL)
{
d.update(id2str, (U32)strlen((char *) id2str));
d.update(id2str, (U32)strlen((char *) id2str)); /* Flawfinder: ignore */
}
d.finalize();

View File

@ -57,7 +57,7 @@ char* LLMessageStringTable::getString(const char *str)
}
}
// not found, so add!
strncpy(mString[hash_value], str, MESSAGE_MAX_STRINGS_LENGTH);
strncpy(mString[hash_value], str, MESSAGE_MAX_STRINGS_LENGTH); /* Flawfinder: ignore */
mString[hash_value][MESSAGE_MAX_STRINGS_LENGTH - 1] = 0;
mEmpty[hash_value] = FALSE;
mUsed++;

View File

@ -124,7 +124,7 @@ char *u32_to_ip_string(U32 ip, char *ip_string)
if (result != NULL)
{
//the function signature needs to change to pass in the lengfth of first and last.
strcpy(ip_string, result);
strcpy(ip_string, result); /*Flawfinder: ignore*/
return ip_string;
}
else

View File

@ -1246,7 +1246,7 @@ BOOL LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed)
{
if ((in != NULL) && (bytesUsed <= sizeof(mData)))
{
memcpy(mData, in, bytesUsed);
memcpy(mData, in, bytesUsed); /* Flawfinder: ignore */
mNumBytes = bytesUsed;
return TRUE;
}

View File

@ -19,7 +19,7 @@ class LLMaterialInfo
{
public:
U8 mMCode;
char mName[LLMATERIAL_INFO_NAME_LENGTH];
char mName[LLMATERIAL_INFO_NAME_LENGTH]; /* Flawfinder: ignore */
LLUUID mDefaultTextureID;
LLUUID mShatterSoundID;
F32 mDensity; // kg/m^3

View File

@ -688,13 +688,13 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode)
// Don't crash or llerrs here! This function is used for debug strings.
const char * LLPrimitive::pCodeToString(const LLPCode pcode)
{
static char pcode_string[255];
static char pcode_string[255]; /* Flawfinder: ignore */
U8 base_code = pcode & LL_PCODE_BASE_MASK;
pcode_string[0] = 0;
if (!pcode)
{
sprintf(pcode_string, "null");
snprintf(pcode_string, sizeof(pcode_string), "null"); /* Flawfinder: ignore */
}
else if ((base_code) == LL_PCODE_LEGACY)
{
@ -702,66 +702,66 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)
switch (pcode)
{
case LL_PCODE_LEGACY_GRASS:
sprintf(pcode_string, "grass");
snprintf(pcode_string, sizeof(pcode_string), "grass"); /* Flawfinder: ignore */
break;
case LL_PCODE_LEGACY_PART_SYS:
sprintf(pcode_string, "particle system");
snprintf(pcode_string, sizeof(pcode_string), "particle system"); /* Flawfinder: ignore */
break;
case LL_PCODE_LEGACY_AVATAR:
sprintf(pcode_string, "avatar");
snprintf(pcode_string, sizeof(pcode_string), "avatar"); /* Flawfinder: ignore */
break;
case LL_PCODE_LEGACY_TEXT_BUBBLE:
sprintf(pcode_string, "text bubble");
snprintf(pcode_string, sizeof(pcode_string), "text bubble"); /* Flawfinder: ignore */
break;
case LL_PCODE_LEGACY_TREE:
sprintf(pcode_string, "tree");
snprintf(pcode_string, sizeof(pcode_string), "tree"); /* Flawfinder: ignore */
break;
case LL_PCODE_TREE_NEW:
sprintf(pcode_string, "tree_new");
snprintf(pcode_string, sizeof(pcode_string), "tree_new"); /* Flawfinder: ignore */
break;
default:
sprintf(pcode_string, "unknown legacy pcode %i",(U32)pcode);
snprintf(pcode_string, sizeof(pcode_string), "unknown legacy pcode %i",(U32)pcode); /* Flawfinder: ignore */
}
}
else
{
char shape[32];
char mask[32];
char shape[32]; /* Flawfinder: ignore */
char mask[32]; /* Flawfinder: ignore */
if (base_code == LL_PCODE_CUBE)
{
sprintf(shape, "cube");
snprintf(shape, sizeof(shape), "cube"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_CYLINDER)
{
sprintf(shape, "cylinder");
snprintf(shape, sizeof(shape), "cylinder"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_CONE)
{
sprintf(shape, "cone");
snprintf(shape, sizeof(shape), "cone"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_PRISM)
{
sprintf(shape, "prism");
snprintf(shape, sizeof(shape), "prism"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_PYRAMID)
{
sprintf(shape, "pyramid");
snprintf(shape, sizeof(shape), "pyramid"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_SPHERE)
{
sprintf(shape, "sphere");
snprintf(shape, sizeof(shape), "sphere"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_TETRAHEDRON)
{
sprintf(shape, "tetrahedron");
snprintf(shape, sizeof(shape), "tetrahedron"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_VOLUME)
{
sprintf(shape, "volume");
snprintf(shape, sizeof(shape), "volume"); /* Flawfinder: ignore */
}
else if (base_code == LL_PCODE_APP)
{
sprintf(shape, "app");
snprintf(shape, sizeof(shape), "app"); /* Flawfinder: ignore */
}
else
{
@ -771,15 +771,15 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)
U8 mask_code = pcode & (~LL_PCODE_BASE_MASK);
if (base_code == LL_PCODE_APP)
{
sprintf(mask, "%x", mask_code);
snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */
}
else if (mask_code & LL_PCODE_HEMI_MASK)
{
sprintf(mask, "hemi");
snprintf(mask, sizeof(mask), "hemi"); /* Flawfinder: ignore */
}
else if (mask != 0)
{
sprintf(mask, "%x", mask_code);
snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */
}
else
{
@ -788,11 +788,11 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)
if (mask[0])
{
sprintf(pcode_string, "%s-%s", shape, mask);
snprintf(pcode_string, sizeof(pcode_string), "%s-%s", shape, mask); /* Flawfinder: ignore */
}
else
{
sprintf(pcode_string, "%s", shape);
snprintf(pcode_string, sizeof(pcode_string), "%s", shape); /* Flawfinder: ignore */
}
}
return pcode_string;
@ -1219,7 +1219,7 @@ S32 LLPrimitive::unpackTEField(U8 *cur_ptr, U8 *buffer_end, U8 *data_ptr, U8 dat
for (i = 1; i < face_count; i++)
{
// Already unswizzled, don't need to unswizzle it again!
memcpy(data_ptr+(i*data_size),data_ptr,data_size);
memcpy(data_ptr+(i*data_size),data_ptr,data_size); /* Flawfinder: ignore */
}
while ((cur_ptr < buffer_end) && (*cur_ptr != 0))
@ -1282,7 +1282,7 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const
for (face_index = 0; face_index <= last_face_index; face_index++)
{
// Directly sending image_ids is not safe!
memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16);
memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
// Cast LLColor4 to LLColor4U
coloru.setVec( getTE(face_index)->getColor() );
@ -1358,7 +1358,7 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const
for (face_index = 0; face_index <= last_face_index; face_index++)
{
// Directly sending image_ids is not safe!
memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16);
memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16); /* Flawfinder: ignore */
// Cast LLColor4 to LLColor4U
coloru.setVec( getTE(face_index)->getColor() );
@ -1569,7 +1569,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
for (i = 0; i < face_count; i++)
{
// llinfos << "BUMP unpack (Datapacker) [" << i << "]=" << S32(bump[i]) <<llendl;
memcpy(image_ids[i].mData,&image_data[i*16],16);
memcpy(image_ids[i].mData,&image_data[i*16],16); /* Flawfinder: ignore */
}
LLColor4 color;

View File

@ -136,7 +136,7 @@ LLString LLFontGL::getFontPathSystem()
// Try to figure out where the system's font files are stored.
char *system_root = NULL;
#if LL_WINDOWS
system_root = getenv("SystemRoot");
system_root = getenv("SystemRoot"); /* Flawfinder: ignore */
if (!system_root)
{
llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl;

View File

@ -70,8 +70,8 @@ char *fv4(F32 *f)
//------------------------------------------------------------------------
char *fv3(F32 *f)
{
static char str[128];
sprintf(str, "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]);
static char str[128]; /* Flawfinder: ignore */
snprintf(str, sizeof(str), "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]); /* Flawfinder: ignore */
return str;
}
@ -80,8 +80,8 @@ char *fv3(F32 *f)
//------------------------------------------------------------------------
char *fv1(F32 *f)
{
static char str[128];
sprintf(str, "%8.3f", f[0]);
static char str[128]; /* Flawfinder: ignore */
snprintf(str, sizeof(str), "%8.3f", f[0]); /* Flawfinder: ignore */
return str;
}

View File

@ -498,7 +498,7 @@ LLView* LLFloater::getRootMostFastFrameView()
return LLView::getRootMostFastFrameView();
}
void LLFloater::open()
void LLFloater::open() /* Flawfinder: ignore */
{
//RN: for now, we don't allow rehosting from one multifloater to another
// just need to fix the bugs
@ -1188,7 +1188,7 @@ void LLFloater::onClickTearOff(void *userdata)
new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight());
self->open();
self->open(); /* Flawfinder: ignore */
self->setRect(new_rect);
gFloaterView->adjustToFitScreen(self, FALSE);
self->setCanDrag(TRUE);
@ -2424,11 +2424,11 @@ void LLMultiFloater::init(const LLString& title, BOOL resizable,
addChild(mTabContainer);*/
}
void LLMultiFloater::open()
void LLMultiFloater::open() /* Flawfinder: ignore */
{
if (mTabContainer->getTabCount() > 0)
{
LLFloater::open();
LLFloater::open(); /* Flawfinder: ignore */
}
else
{
@ -2853,7 +2853,7 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
return floaterp;
}
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open)
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */
{
LLString name(getName());
LLString title(getTitle());
@ -2927,8 +2927,8 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
}
applyRectControl();
if (open)
if (open) /* Flawfinder: ignore */
{
this->open();
this->open(); /* Flawfinder: ignore */
}
}

View File

@ -103,7 +103,7 @@ public:
virtual EWidgetType getWidgetType() const;
virtual LLString getWidgetTag() const;
virtual void open();
virtual void open(); /* Flawfinder: ignore */
// If allowed, close the floater cleanly, releasing focus.
// app_quitting is passed to onClose() below.
@ -342,7 +342,7 @@ public:
BOOL minimizable, BOOL close_btn);
virtual BOOL postBuild();
/*virtual*/ void open();
/*virtual*/ void open(); /* Flawfinder: ignore */
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void draw();
/*virtual*/ void setVisible(BOOL visible);

View File

@ -54,10 +54,10 @@ BOOL LLKeywords::loadFromFile( const LLString& filename )
// File header
const S32 BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */
llifstream file;
file.open(filename.c_str());
file.open(filename.c_str()); /* Flawfinder: ignore */
if( file.fail() )
{
llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl;
@ -95,34 +95,34 @@ BOOL LLKeywords::loadFromFile( const LLString& filename )
while (!file.eof())
{
file.getline( buffer, BUFFER_SIZE );
if( !strncmp( buffer, SOL_COMMENT, strlen(SOL_COMMENT) ) )
if( !strncmp( buffer, SOL_COMMENT, strlen(SOL_COMMENT) ) ) /* Flawfinder: ignore */
{
continue;
}
else
if( !strncmp( buffer, SOL_WORD, strlen(SOL_WORD) ) )
if( !strncmp( buffer, SOL_WORD, strlen(SOL_WORD) ) ) /* Flawfinder: ignore */
{
cur_color = readColor( buffer + strlen(SOL_WORD) );
cur_color = readColor( buffer + strlen(SOL_WORD) ); /* Flawfinder: ignore */
cur_type = LLKeywordToken::WORD;
continue;
}
else
if( !strncmp( buffer, SOL_LINE, strlen(SOL_LINE) ) )
if( !strncmp( buffer, SOL_LINE, strlen(SOL_LINE) ) ) /* Flawfinder: ignore */
{
cur_color = readColor( buffer + strlen(SOL_LINE) );
cur_color = readColor( buffer + strlen(SOL_LINE) ); /* Flawfinder: ignore */
cur_type = LLKeywordToken::LINE;
continue;
}
else
if( !strncmp( buffer, SOL_TWO_SIDED_DELIMITER, strlen(SOL_TWO_SIDED_DELIMITER) ) )
if( !strncmp( buffer, SOL_TWO_SIDED_DELIMITER, strlen(SOL_TWO_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */
{
cur_color = readColor( buffer + strlen(SOL_TWO_SIDED_DELIMITER) );
cur_color = readColor( buffer + strlen(SOL_TWO_SIDED_DELIMITER) ); /* Flawfinder: ignore */
cur_type = LLKeywordToken::TWO_SIDED_DELIMITER;
continue;
}
if( !strncmp( buffer, SOL_ONE_SIDED_DELIMITER, strlen(SOL_ONE_SIDED_DELIMITER) ) )
if( !strncmp( buffer, SOL_ONE_SIDED_DELIMITER, strlen(SOL_ONE_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */
{
cur_color = readColor( buffer + strlen(SOL_ONE_SIDED_DELIMITER) );
cur_color = readColor( buffer + strlen(SOL_ONE_SIDED_DELIMITER) ); /* Flawfinder: ignore */
cur_type = LLKeywordToken::ONE_SIDED_DELIMITER;
continue;
}
@ -201,7 +201,7 @@ LLColor3 LLKeywords::readColor( const LLString& s )
F32 r, g, b;
r = g = b = 0.0f;
S32 read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b );
if( read != 3 )
if( read != 3 ) /* Flawfinder: ignore */
{
llinfos << " poorly formed color in keyword file" << llendl;
}

View File

@ -4579,7 +4579,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup)
LLTearOffMenu* tearoffp = new LLTearOffMenu(menup);
// keep onscreen
gFloaterView->adjustToFitScreen(tearoffp, FALSE);
tearoffp->open();
tearoffp->open(); /* Flawfinder: ignore */
return tearoffp;
}

View File

@ -302,8 +302,8 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const
}
S32 group_count = cur_group;
char reversed_output[20] = "";
char forward_output[20] = "";
char reversed_output[20] = ""; /* Flawfinder: ignore */
char forward_output[20] = ""; /* Flawfinder: ignore */
S32 output_pos = 0;
cur_group = 0;

View File

@ -3763,7 +3763,7 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer )
// <text without \0> (text may contain ext_char_values)
// }\n
char tbuf[MAX_STRING];
char tbuf[MAX_STRING]; /* Flawfinder: ignore */
S32 version = 0;
instream.getline(tbuf, MAX_STRING);
@ -3803,11 +3803,16 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer )
BOOL success = TRUE;
char* text = new char[ text_len + 1];
if (text == NULL)
{
llerrs << "Memory allocation failure." << llendl;
return FALSE;
}
instream.get(text, text_len + 1, '\0');
text[text_len] = '\0';
if( text_len != (S32)strlen(text) )
if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */
{
llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl;
llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl;/* Flawfinder: ignore */
success = FALSE;
}

View File

@ -1478,7 +1478,7 @@ void load_tr(const LLString& lang)
LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, inname.c_str());
llifstream file;
file.open(filename.c_str(), std::ios_base::binary);
file.open(filename.c_str(), std::ios_base::binary); /* Flawfinder: ignore */
if (!file)
{
llinfos << "No translation dictionary for: " << filename << llendl;
@ -1491,7 +1491,7 @@ void load_tr(const LLString& lang)
gUntranslated.clear();
const S32 MAX_LINE_LEN = 1024;
char buffer[MAX_LINE_LEN];
char buffer[MAX_LINE_LEN]; /* Flawfinder: ignore */
while (!file.eof())
{
file.getline(buffer, MAX_LINE_LEN);
@ -1531,7 +1531,7 @@ void cleanup_tr()
LLString outname = "untranslated_" + gLanguage + ".txt";
LLString outfilename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, outname.c_str());
llofstream outfile;
outfile.open(outfilename.c_str());
outfile.open(outfilename.c_str()); /* Flawfinder: ignore */
if (!outfile)
{
return;

View File

@ -278,7 +278,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr&
// buildFloater()
//-----------------------------------------------------------------------------
void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename,
const LLCallbackMap::map_t* factory_map, BOOL open)
const LLCallbackMap::map_t* factory_map, BOOL open) /* Flawfinder: ignore */
{
LLXMLNodePtr root;
@ -299,7 +299,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
mFactoryStack.push_front(factory_map);
}
floaterp->initFloaterXML(root, NULL, this, open);
floaterp->initFloaterXML(root, NULL, this, open); /* Flawfinder: ignore */
if (LLUI::sShowXUINames)
{

View File

@ -323,7 +323,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string &file
std::string LLDir::getTempFilename() const
{
LLUUID random_uuid;
char uuid_str[64];
char uuid_str[64]; /* Flawfinder: ignore */
random_uuid.generate();
random_uuid.toString(uuid_str);

View File

@ -32,7 +32,7 @@ static std::string getCurrentUserHome(char* fallback)
else
{
llinfos << "Couldn't detect home directory from passwd - trying $HOME" << llendl;
const char *const home_env = getenv("HOME");
const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */
if (home_env)
{
result_cstr = (char*) home_env;
@ -54,7 +54,7 @@ LLDir_Linux::LLDir_Linux()
mCurrentDirCount = -1;
mDirp = NULL;
char tmp_str[LL_MAX_PATH];
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
getcwd(tmp_str, LL_MAX_PATH);
mExecutableFilename = "";
@ -66,13 +66,13 @@ LLDir_Linux::LLDir_Linux()
mOSUserAppDir = "";
mLindenUserDir = tmp_str;
char path [32];
char path [32]; /* Flawfinder: ignore */
// *NOTE: /proc/%d/exe doesn't work on FreeBSD. But that's ok,
// because this is the linux implementation.
sprintf (path, "/proc/%d/exe", (int) getpid ());
int rc = readlink (path, tmp_str, sizeof (tmp_str)-1);
snprintf (path, sizeof(path), "/proc/%d/exe", (int) getpid ()); /* Flawfinder: ignore */
int rc = readlink (path, tmp_str, sizeof (tmp_str)-1); /* Flawfinder: ignore */
if ( (rc != -1) && (rc <= ((int) sizeof (tmp_str)-1)) )
{
tmp_str[rc] = '\0'; //readlink() doesn't 0-terminate the buffer
@ -109,7 +109,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
LLString upper_app_name(app_name);
LLString::toUpper(upper_app_name);
char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str());
char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */
if (app_home_env)
{
// user has specified own userappdir i.e. $SECONDLIFE_USER_DIR
@ -307,7 +307,7 @@ void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::stri
std::string LLDir_Linux::getCurPath()
{
char tmp_str[LL_MAX_PATH];
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
getcwd(tmp_str, LL_MAX_PATH);
return tmp_str;
}

View File

@ -335,7 +335,7 @@ S32 LLDir_Mac::deleteFilesInDir(const std::string &dirname, const std::string &m
std::string LLDir_Mac::getCurPath()
{
char tmp_str[LL_MAX_PATH];
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
getcwd(tmp_str, LL_MAX_PATH);
return tmp_str;
}

View File

@ -45,9 +45,9 @@ LLDir_Win32::LLDir_Win32()
if (GetTempPath(MAX_PATH, w_str))
{
if (wcslen(w_str))
if (wcslen(w_str)) /* Flawfinder: ignore */
{
w_str[wcslen(w_str)-1] = '\0'; // remove trailing slash
w_str[wcslen(w_str)-1] = '\0'; /* Flawfinder: ignore */ // remove trailing slash
}
mTempDir = utf16str_to_utf8str(llutf16string(w_str));
}
@ -342,7 +342,7 @@ DWORD GetDllVersion(LPCTSTR lpszDllName)
HINSTANCE hinstDll;
DWORD dwVersion = 0;
hinstDll = LoadLibrary(lpszDllName);
hinstDll = LoadLibrary(lpszDllName); /* Flawfinder: ignore */
if(hinstDll)
{

View File

@ -58,7 +58,7 @@ LLLFSThread::~LLLFSThread()
//----------------------------------------------------------------------------
LLLFSThread::handle_t LLLFSThread::read(const LLString& filename,
LLLFSThread::handle_t LLLFSThread::read(const LLString& filename, /* Flawfinder: ignore */
U8* buffer, S32 offset, S32 numbytes, U32 priority, U32 flags)
{
handle_t handle = generateHandle();

View File

@ -89,7 +89,7 @@ public:
~LLLFSThread();
// Return a Request handle
handle_t read(const LLString& filename,
handle_t read(const LLString& filename, /* Flawfinder: ignore */
U8* buffer, S32 offset, S32 numbytes, U32 pri=PRIORITY_NORMAL, U32 flags = 0);
handle_t write(const LLString& filename,
U8* buffer, S32 offset, S32 numbytes, U32 flags = 0);

View File

@ -116,7 +116,7 @@ U8* LLVFile::readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S
else
{
data = new U8[file_size];
file.read(data, file_size);
file.read(data, file_size); /* Flawfinder: ignore */
if (file.getLastBytesRead() != (S32)file_size)
{

View File

@ -20,7 +20,7 @@ public:
LLVFile(LLVFS *vfs, const LLUUID &file_id, const LLAssetType::EType file_type, S32 mode = LLVFile::READ);
~LLVFile();
BOOL read(U8 *buffer, S32 bytes, BOOL async = FALSE, F32 priority = 128.f);
BOOL read(U8 *buffer, S32 bytes, BOOL async = FALSE, F32 priority = 128.f); /* Flawfinder: ignore */
static U8* readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read = 0);
void setReadPriority(const F32 priority);
BOOL isReadComplete();

View File

@ -110,7 +110,7 @@ public:
}
#ifdef LL_LITTLE_ENDIAN
inline void swizzleCopy(void *dst, void *src, int size) { memcpy(dst, src, size); }
inline void swizzleCopy(void *dst, void *src, int size) { memcpy(dst, src, size); /* Flawfinder: ignore */}
#else
@ -137,7 +137,7 @@ public:
else
{
// Perhaps this should assert...
memcpy(dst, src, size);
memcpy(dst, src, size); /* Flawfinder: ignore */
}
}
@ -151,7 +151,7 @@ public:
buffer +=4;
swizzleCopy(buffer, &mAccessTime, 4);
buffer +=4;
memcpy(buffer, &mFileID.mData, 16);
memcpy(buffer, &mFileID.mData, 16); /* Flawfinder: ignore */
buffer += 16;
S16 temp_type = mFileType;
swizzleCopy(buffer, &temp_type, 2);
@ -220,10 +220,15 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
}
mValid = VFSVALID_OK;
mReadOnly = read_only;
mIndexFilename = new char[strlen(index_filename) + 1];
mDataFilename = new char[strlen(data_filename) + 1];
strcpy(mIndexFilename, index_filename);
strcpy(mDataFilename, data_filename);
mIndexFilename = new char[strlen(index_filename) + 1]; /* Flawfinder: ignore */
mDataFilename = new char[strlen(data_filename) + 1]; /* Flawfinder: ignore */
if (mIndexFilename == NULL || mDataFilename == NULL)
{
llerrs << "Memory Allocation Failure" << llendl;
return;
}
strcpy(mIndexFilename, index_filename); /* Flawfinder: ignore */
strcpy(mDataFilename, data_filename); /* Flawfinder: ignore */
const char *file_mode = mReadOnly ? "rb" : "r+b";
@ -247,13 +252,23 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
{
llwarns << "Can't open VFS data file " << mDataFilename << " attempting to use alternate" << llendl;
char *temp_index = new char[strlen(mIndexFilename) + 10];
char *temp_data = new char[strlen(mDataFilename) + 10];
char *temp_index = new char[strlen(mIndexFilename) + 10]; /* Flawfinder: ignore */
if (!temp_index)
{
llerrs << "Out of the memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
return;
}
char *temp_data = new char[strlen(mDataFilename) + 10]; /* Flawfinder: ignore */
if (!temp_data)
{
llerrs << "Out of the memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
return;
}
for (U32 count = 0; count < 256; count++)
{
sprintf(temp_index, "%s.%u", mIndexFilename, count);
sprintf(temp_data, "%s.%u", mDataFilename, count);
sprintf(temp_index, "%s.%u", mIndexFilename, count); /* Flawfinder: ignore */
sprintf(temp_data, "%s.%u", mDataFilename, count); /* Flawfinder: ignore */
// try just opening, then creating, each alternate
if ((mDataFP = openAndLock(temp_data, "r+b", FALSE)))
@ -294,8 +309,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
if (!mReadOnly && mRemoveAfterCrash)
{
llstat marker_info;
char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1];
sprintf(marker, "%s.open", mDataFilename);
char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1]; /* Flawfinder: ignore */
if (!marker )
{
llerrs << "Out of memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
return;
}
sprintf(marker, "%s.open", mDataFilename); /* Flawfinder: ignore */
if (!LLFile::stat(marker, &marker_info))
{
// marker exists, kill the lock and the VFS files
@ -523,8 +543,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
if (!mReadOnly && mRemoveAfterCrash)
{
char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1];
sprintf(marker, "%s.open", mDataFilename);
FILE* marker_fp = LLFile::fopen(marker, "w");
if (!marker)
{
llerrs << "Out of memory in LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)" << llendl;
return;
}
sprintf(marker, "%s.open", mDataFilename); /* Flawfinder: ignore */
FILE* marker_fp = LLFile::fopen(marker, "w"); /* Flawfinder: ignore */
if (marker_fp)
{
fclose(marker_fp);
@ -567,7 +592,12 @@ LLVFS::~LLVFS()
if (!mReadOnly && mRemoveAfterCrash)
{
char* marker_file = new char[strlen(mDataFilename) + strlen(".open") + 1];
sprintf(marker_file, "%s.open", mDataFilename);
if (marker_file == NULL)
{
llerrs << "Memory Allocation Failure" << llendl;
return;
}
sprintf(marker_file, "%s.open", mDataFilename); /* Flawfinder: ignore */
LLFile::remove(marker_file);
delete [] marker_file;
marker_file = NULL;
@ -2045,7 +2075,7 @@ FILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_lock)
// first test the lock in a non-destructive way
if (strstr(mode, "w"))
{
fp = LLFile::fopen(filename, "rb");
fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp)
{
fd = fileno(fp);
@ -2060,7 +2090,7 @@ FILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_lock)
}
// now actually open the file for use
fp = LLFile::fopen(filename, mode);
fp = LLFile::fopen(filename, mode); /* Flawfinder: ignore */
if (fp)
{
fd = fileno(fp);

View File

@ -64,7 +64,7 @@ public:
}
std::string getFilename()
{
char tbuf[40];
char tbuf[40]; /* Flawfinder: ignore */
mFileID.toString(tbuf);
return std::string(tbuf);
}
@ -97,7 +97,7 @@ public:
~LLVFSThread();
// Return a Request handle
handle_t read(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type,
handle_t read(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type, /* Flawfinder: ignore */
U8* buffer, S32 offset, S32 numbytes, U32 pri=PRIORITY_NORMAL, U32 flags = 0);
handle_t write(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type,
U8* buffer, S32 offset, S32 numbytes, U32 flags);

View File

@ -47,16 +47,16 @@ std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName)
switch( var.vt )
{
case VT_UI4:
swprintf( wszPropValue, L"%d", var.ulVal );
swprintf( wszPropValue, L"%d", var.ulVal ); /* Flawfinder: ignore */
break;
case VT_I4:
swprintf( wszPropValue, L"%d", var.lVal );
swprintf( wszPropValue, L"%d", var.lVal ); /* Flawfinder: ignore */
break;
case VT_BOOL:
wcscpy( wszPropValue, (var.boolVal) ? L"true" : L"false" );
wcscpy( wszPropValue, (var.boolVal) ? L"true" : L"false" ); /* Flawfinder: ignore */
break;
case VT_BSTR:
wcsncpy( wszPropValue, var.bstrVal, 255 );
wcsncpy( wszPropValue, var.bstrVal, 255 ); /* Flawfinder: ignore */
wszPropValue[255] = 0;
break;
}

View File

@ -311,7 +311,7 @@ LLString LLKeyboard::stringFromKey(KEY key)
LLString res = get_if_there(sKeysToNames, key, LLString::null);
if (res.empty())
{
char buffer[2];
char buffer[2]; /* Flawfinder: ignore */
buffer[0] = key;
buffer[1] = '\0';
res = LLString(buffer);

View File

@ -70,8 +70,8 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
{
if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))
{
char buffer[1024];
sprintf(buffer,
char buffer[1024];/* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */
"Your video card appears to be a %s, which Second Life does not support.\n"
"\n"
"Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@ -227,8 +227,8 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
// Stash the window title
strcpy((char*)mWindowTitle + 1, title);
mWindowTitle[0] = strlen(title);
strcpy((char*)mWindowTitle + 1, title); /* Flawfinder: ignore */
mWindowTitle[0] = strlen(title); /* Flawfinder: ignore */
mEventHandlerUPP = NewEventHandlerUPP(staticEventHandler);
mGlobalHandlerRef = NULL;
@ -405,8 +405,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
mFullscreenBits = -1;
mFullscreenRefresh = -1;
char error[256];
sprintf(error, "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
char error[256]; /* Flawfinder: ignore */
snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */
OSMessageBox(error, "Error", OSMB_OK);
}
}
@ -2719,7 +2719,7 @@ void spawn_web_browser(const char* escaped_url)
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
S32 len = strlen(gURLProtocolWhitelist[i]);
S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
&& escaped_url[len] == ':')
{

View File

@ -134,8 +134,8 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
{
if (!strncasecmp(RENDERER, bad_card, strlen(bad_card)))
{
char buffer[1024];
sprintf(buffer,
char buffer[1024]; /* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */
"Your video card appears to be a %s, which Second Life does not support.\n"
"\n"
"Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@ -197,9 +197,14 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
title = "SDL Window"; // *FIX: (???)
// Stash the window title
mWindowTitle = new char[strlen(title) + 1];
strcpy(mWindowTitle, title);
mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */
if(mWindowTitle == NULL)
{
llerrs << "Memory allocation failure" << llendl;
return;
}
strcpy(mWindowTitle, title); /* Flawfinder: ignore */
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
{
@ -223,10 +228,10 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
static SDL_Surface *Load_BMP_Resource(const char *basename)
{
const int PATH_BUFFER_SIZE=1000;
char path_buffer[PATH_BUFFER_SIZE];
char path_buffer[PATH_BUFFER_SIZE]; /* Flawfinder: ignore */
// Figure out where our BMP is living on the disk
snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s",
snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s", /* Flawfinder: ignore */
gDirUtilp->getAppRODataDir().c_str(),
gDirUtilp->getDirDelimiter().c_str(),
gDirUtilp->getDirDelimiter().c_str(),
@ -396,8 +401,8 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
mFullscreenBits = -1;
mFullscreenRefresh = -1;
char error[256];
sprintf(error, "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
char error[256]; /* Flawfinder: ignore */
snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */
OSMessageBox(error, "Error", OSMB_OK);
}
}
@ -1060,9 +1065,9 @@ x11clipboard_type convert_format(int type)
{
/* completely arbitrary clipboard types... we don't actually use
these right now, and support is skeletal. */
char format[sizeof(FORMAT_PREFIX)+8+1];
char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */
sprintf(format, "%s%08lx", FORMAT_PREFIX, (unsigned long)type);
snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type); /* Flawfinder: ignore */
return XInternAtom(SDL_Display, format, False);
}
}
@ -1080,14 +1085,18 @@ convert_data(int type, char *dst, const char *src, int srclen)
{
case SDLCLIPTYPE('T', 'E', 'X', 'T'):
case SDLCLIPTYPE('U', 'T', 'F', '8'):
if (src == NULL)
{
break;
}
if ( srclen == 0 )
srclen = strlen(src);
srclen = strlen(src); /* Flawfinder: ignore */
dstlen = srclen + 1;
if ( dst ) // assume caller made it big enough by asking us
{
memcpy(dst, src, srclen);
memcpy(dst, src, srclen); /* Flawfinder: ignore */
dst[srclen] = '\0';
}
break;
@ -1112,14 +1121,18 @@ convert_x11clipboard(int type, char *dst, const char *src, int srclen)
{
case SDLCLIPTYPE('U', 'T', 'F', '8'):
case SDLCLIPTYPE('T', 'E', 'X', 'T'):
if (src == NULL)
{
break;
}
if ( srclen == 0 )
srclen = strlen(src);
srclen = strlen(src); /* Flawfinder: ignore */
dstlen = srclen + 1;
if ( dst ) // assume caller made it big enough by asking us
{
memcpy(dst, src, srclen);
memcpy(dst, src, srclen); /* Flawfinder: ignore */
dst[srclen] = '\0';
}
break;
@ -1451,7 +1464,11 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
{
std::string utf8text = wstring_to_utf8str(s);
const char* cstr = utf8text.c_str();
int cstrlen = strlen(cstr);
if (cstr == NULL)
{
return FALSE;
}
int cstrlen = strlen(cstr); /* Flawfinder: ignore */
int i;
for (i=0; i<cstrlen; ++i)
{
@ -2442,7 +2459,7 @@ void spawn_web_browser(const char* escaped_url)
close(1);
close(2);
// end ourself by running the command
execv(cmd.c_str(), argv);
execv(cmd.c_str(), argv); /* Flawfinder: ignore */
// if execv returns at all, there was a problem.
llwarns << "execv failure when trying to start " << cmd << llendl;
_exit(1); // _exit because we don't want atexit() clean-up!

View File

@ -77,10 +77,14 @@ void show_window_creation_error(const char* title)
BOOL check_for_card(const char* RENDERER, const char* bad_card)
{
if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))
if(bad_card == NULL)
{
char buffer[1024];
sprintf(buffer,
return FALSE;
}
if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) /* Flawfinder: ignore */
{
char buffer[1024]; /* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */
"Your video card appears to be a %s, which Second Life does not support.\n"
"\n"
"Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@ -329,8 +333,8 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
mFullscreenBits = -1;
mFullscreenRefresh = -1;
char error[256];
sprintf(error, "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
char error[256]; /* Flawfinder: ignore */
snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */
OSMessageBox(error, "Error", OSMB_OK);
}
}
@ -2450,7 +2454,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
WCHAR* copy_utf16 = (WCHAR*) GlobalLock(hglobal_copy_utf16);
if (copy_utf16)
{
memcpy(copy_utf16, out_utf16.c_str(), size_utf16);
memcpy(copy_utf16, out_utf16.c_str(), size_utf16); /* Flawfinder: ignore */
GlobalUnlock(hglobal_copy_utf16);
if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16))
@ -2474,7 +2478,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
char* copy = (char*) GlobalLock(hglobal_copy);
if( copy )
{
memcpy(copy, out_s.c_str(), size);
memcpy(copy, out_s.c_str(), size); /* Flawfinder: ignore */
GlobalUnlock(hglobal_copy);
if (SetClipboardData(CF_TEXT, hglobal_copy))
@ -2575,7 +2579,7 @@ BOOL LLWindowWin32::sendEmail(const char* address, const char* subject, const ch
}
else
{
HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL");
HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL"); /* Flawfinder: ignore */
if(!hMAPIInst)
{
result = LL_EMAIL_MAPILOAD_FAILED;
@ -3093,7 +3097,7 @@ void spawn_web_browser(const char* escaped_url )
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
S32 len = strlen(gURLProtocolWhitelist[i]);
S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
&& escaped_url[len] == ':')
{
@ -3112,8 +3116,8 @@ void spawn_web_browser(const char* escaped_url )
// Figure out the user's default web browser
// HKEY_CLASSES_ROOT\http\shell\open\command
char reg_path_str[256];
sprintf(reg_path_str, "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]);
char reg_path_str[256]; /* Flawfinder: ignore */
snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); /* Flawfinder: ignore */
WCHAR reg_path_wstr[256];
mbstowcs(reg_path_wstr, reg_path_str, 1024);
@ -3164,7 +3168,7 @@ void spawn_web_browser(const char* escaped_url )
// MS docs say to cast to int and compare to 32.
HWND our_window = NULL;
LPCWSTR directory_wstr = NULL;
int retval = (int) ShellExecute(our_window,
int retval = (int) ShellExecute(our_window, /* Flawfinder: ignore */
L"open",
browser_exec_utf16.c_str(),
url_utf16.c_str(),
@ -3188,7 +3192,7 @@ void shell_open( const char* file_path )
mbstowcs(wstr, file_path, 1024);
HWND our_window = NULL;
int retval = (int) ShellExecute(our_window, L"open", wstr, NULL, NULL, SW_SHOWNORMAL);
int retval = (int) ShellExecute(our_window, L"open", wstr, NULL, NULL, SW_SHOWNORMAL); /* Flawfinder: ignore */
if (retval > 32)
{
llinfos << "ShellExecute success with " << retval << llendl;

View File

@ -580,7 +580,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
llifstream file;
S32 version;
file.open(filename.c_str());
file.open(filename.c_str()); /*Flawfinder: ignore*/
if (!file)
{
@ -610,7 +610,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
if (name.substr(0,2) == "//")
{
// This is a comment.
char buffer[MAX_STRING];
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
file.getline(buffer, MAX_STRING);
continue;
}
@ -624,7 +624,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
if (!name.empty())
{
//read in to end of line
char buffer[MAX_STRING];
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
file.getline(buffer, MAX_STRING);
llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
}
@ -690,7 +690,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
break;
case TYPE_BOOLEAN:
{
char boolstring[256];
char boolstring[256]; /*Flawfinder: ignore*/
BOOL valid = FALSE;
BOOL initial = FALSE;
@ -1048,7 +1048,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
}
llofstream file;
file.open(filename.c_str());
file.open(filename.c_str()); /*Flawfinder: ignore*/
if (!file.is_open())
{

View File

@ -542,7 +542,7 @@ bool LLXMLNode::parseFile(
LLXMLNode* defaults_tree)
{
// Read file
FILE* fp = LLFile::fopen(filename.c_str(), "rb");
FILE* fp = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */
if (fp == NULL)
{
node = new LLXMLNode();
@ -1846,12 +1846,12 @@ U32 LLXMLNode::getUUIDValue(U32 expected_length, LLUUID *array)
LLUUID uuid_value;
value_string = skipWhitespace(value_string);
if (strlen(value_string) < (UUID_STR_LENGTH-1))
if (strlen(value_string) < (UUID_STR_LENGTH-1)) /* Flawfinder: ignore */
{
break;
}
char uuid_string[UUID_STR_LENGTH];
memcpy(uuid_string, value_string, (UUID_STR_LENGTH-1));
char uuid_string[UUID_STR_LENGTH]; /* Flawfinder: ignore */
memcpy(uuid_string, value_string, (UUID_STR_LENGTH-1)); /* Flawfinder: ignore */
uuid_string[(UUID_STR_LENGTH-1)] = 0;
if (!LLUUID::parseUUID(uuid_string, &uuid_value))
@ -2136,18 +2136,18 @@ void LLXMLNode::setFloatValue(U32 length, const F32 *array, Encoding encoding, U
LLString new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
char format_string[10];
char format_string[10]; /* Flawfinder: ignore */
if (precision > 0)
{
if (precision > 25)
{
precision = 25;
}
sprintf(format_string, "%%.%dg", precision);
snprintf(format_string, sizeof(format_string), "%%.%dg", precision); /* Flawfinder: ignore */
}
else
{
sprintf(format_string, "%%g");
snprintf(format_string, sizeof(format_string), "%%g"); /* Flawfinder: ignore */
}
for (U32 pos=0; pos<length; ++pos)
@ -2187,18 +2187,18 @@ void LLXMLNode::setDoubleValue(U32 length, const F64 *array, Encoding encoding,
LLString new_value;
if (encoding == ENCODING_DEFAULT || encoding == ENCODING_DECIMAL)
{
char format_string[10];
char format_string[10]; /* Flawfinder: ignore */
if (precision > 0)
{
if (precision > 25)
{
precision = 25;
}
sprintf(format_string, "%%.%dg", precision);
snprintf(format_string, sizeof(format_string), "%%.%dg", precision); /* Flawfinder: ignore */
}
else
{
sprintf(format_string, "%%g");
snprintf(format_string, sizeof(format_string), "%%g"); /* Flawfinder: ignore */
}
for (U32 pos=0; pos<length; ++pos)
{
@ -2472,7 +2472,7 @@ LLXMLNode *get_rand_node(LLXMLNode *node)
void LLXMLNode::createUnitTest(S32 max_num_children)
{
// Random ID
char rand_id[20];
char rand_id[20]; /* Flawfinder: ignore */
U32 rand_id_len = get_rand(10)+5;
U32 pos = 0;
for (; pos<rand_id_len; ++pos)
@ -2501,7 +2501,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children)
for (U32 child_num=0; child_num<num_children; ++child_num)
{
// Random Name
char child_name[20];
char child_name[20]; /* Flawfinder: ignore */
U32 child_name_len = get_rand(10)+5;
pos = 0;
for (; pos<child_name_len; ++pos)
@ -2513,7 +2513,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children)
LLXMLNode *new_child = createChild(child_name, FALSE);
// Random ID
char child_id[20];
char child_id[20]; /* Flawfinder: ignore */
U32 child_id_len = get_rand(10)+5;
pos = 0;
for (; pos<child_id_len; ++pos)
@ -2634,7 +2634,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children)
{
random_node_array[value] = get_rand_node(root);
const char *node_name = random_node_array[value]->mName->mString;
for (U32 pos=0; pos<strlen(node_name); ++pos)
for (U32 pos=0; pos<strlen(node_name); ++pos) /* Flawfinder: ignore */
{
U32 hash_contrib = U32(node_name[pos]) << ((pos % 4) * 8);
noderef_checksum ^= hash_contrib;
@ -2806,7 +2806,7 @@ BOOL LLXMLNode::performUnitTest(LLString &error_buffer)
for (U32 pos=0; pos<node->mLength; ++pos)
{
const char *node_name = node_array[pos]->mName->mString;
for (U32 pos2=0; pos2<strlen(node_name); ++pos2)
for (U32 pos2=0; pos2<strlen(node_name); ++pos2) /* Flawfinder: ignore */
{
U32 hash_contrib = U32(node_name[pos2]) << ((pos2 % 4) * 8);
noderef_checksum ^= hash_contrib;

View File

@ -22,7 +22,7 @@ LLXmlParser::LLXmlParser()
mParser( NULL ),
mDepth( 0 )
{
strcpy( mAuxErrorString, "no error" );
strcpy( mAuxErrorString, "no error" ); /* Flawfinder: ignore */
// Override the document's declared encoding.
mParser = XML_ParserCreate(NULL);
@ -54,10 +54,10 @@ BOOL LLXmlParser::parseFile(const std::string &path)
BOOL success = TRUE;
FILE *file = LLFile::fopen(path.c_str(), "rb");
FILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */
if( !file )
{
sprintf( mAuxErrorString, "Couldn't open file %s", path.c_str());
snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Couldn't open file %s", path.c_str()); /* Flawfinder: ignore */
success = FALSE;
}
else
@ -71,7 +71,7 @@ BOOL LLXmlParser::parseFile(const std::string &path)
void* buffer = XML_GetBuffer(mParser, buffer_size);
if( !buffer )
{
sprintf( mAuxErrorString, "Unable to allocate XML buffer while reading file %s", path.c_str() );
snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Unable to allocate XML buffer while reading file %s", path.c_str() ); /* Flawfinder: ignore */
success = FALSE;
goto exit_label;
}
@ -79,14 +79,14 @@ BOOL LLXmlParser::parseFile(const std::string &path)
bytes_read = (S32)fread(buffer, 1, buffer_size, file);
if( bytes_read <= 0 )
{
sprintf( mAuxErrorString, "Error while reading file %s", path.c_str() );
snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while reading file %s", path.c_str() ); /* Flawfinder: ignore */
success = FALSE;
goto exit_label;
}
if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) )
{
sprintf( mAuxErrorString, "Error while parsing file %s", path.c_str() );
snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while parsing file %s", path.c_str() ); /* Flawfinder: ignore */
success = FALSE;
}

View File

@ -103,7 +103,7 @@ public:
protected:
XML_Parser mParser;
int mDepth;
char mAuxErrorString[1024];
char mAuxErrorString[1024]; /*Flawfinder: ignore*/
};
#endif // LL_LLXMLPARSER_H

View File

@ -51,7 +51,7 @@ typedef enum e_lscript_registers
LREG_EOF
} LSCRIPTRegisters;
const S32 gLSCRIPTRegisterAddresses[LREG_EOF] =
const S32 gLSCRIPTRegisterAddresses[LREG_EOF] = /* Flawfinder: ignore */
{
0, // LREG_INVALID
4, // LREG_IP
@ -449,7 +449,7 @@ const U8 LSCRIPTTypeHi4Bits[LST_EOF] =
LST_LIST << 4,
};
const char * const LSCRIPTTypeNames[LST_EOF] =
const char * const LSCRIPTTypeNames[LST_EOF] = /*Flawfinder: ignore*/
{
"VOID",
"integer",
@ -492,7 +492,7 @@ typedef enum e_lscript_runtime_faults
LSRF_EOF
} LSCRIPTRunTimeFaults;
extern char *LSCRIPTRunTimeFaultStrings[LSRF_EOF];
extern char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/
const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] =
{

View File

@ -59,7 +59,7 @@ void LLScriptByteCodeChunk::addByte(U8 byte)
if (mCodeChunk)
{
U8 *temp = new U8[mCurrentOffset + 1];
memcpy(temp, mCodeChunk, mCurrentOffset);
memcpy(temp, mCodeChunk, mCurrentOffset); /* Flawfinder: ignore */
delete [] mCodeChunk;
mCodeChunk = temp;
}
@ -83,7 +83,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size)
if (mCodeChunk)
{
U8 *temp = new U8[mCurrentOffset + size];
memcpy(temp, mCodeChunk, mCurrentOffset);
memcpy(temp, mCodeChunk, mCurrentOffset); /* Flawfinder: ignore */
delete [] mCodeChunk;
mCodeChunk = temp;
}
@ -91,7 +91,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size)
{
mCodeChunk = new U8[size];
}
memcpy(mCodeChunk + mCurrentOffset, bytes, size);
memcpy(mCodeChunk + mCurrentOffset, bytes, size);/* Flawfinder: ignore */
mCurrentOffset += size;
}
@ -100,7 +100,7 @@ void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size)
if (mCodeChunk)
{
U8 *temp = new U8[mCurrentOffset + size];
memcpy(temp, mCodeChunk, mCurrentOffset);
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
delete [] mCodeChunk;
mCodeChunk = temp;
}
@ -108,7 +108,7 @@ void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size)
{
mCodeChunk = new U8[size];
}
memcpy(mCodeChunk + mCurrentOffset, bytes, size);
memcpy(mCodeChunk + mCurrentOffset, bytes, size); /*Flawfinder: ignore*/
mCurrentOffset += size;
}
@ -117,7 +117,7 @@ void LLScriptByteCodeChunk::addBytes(S32 size)
if (mCodeChunk)
{
U8 *temp = new U8[mCurrentOffset + size];
memcpy(temp, mCodeChunk, mCurrentOffset);
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
delete [] mCodeChunk;
mCodeChunk = temp;
}
@ -134,7 +134,7 @@ void LLScriptByteCodeChunk::addBytesDontInc(S32 size)
if (mCodeChunk)
{
U8 *temp = new U8[mCurrentOffset + size];
memcpy(temp, mCodeChunk, mCurrentOffset);
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
delete [] mCodeChunk;
mCodeChunk = temp;
}
@ -237,7 +237,7 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp)
mCompleteCode = new U8[mTotalSize];
memset(mCompleteCode, 0, mTotalSize);
memcpy(mCompleteCode, mRegisters->mCodeChunk, mRegisters->mCurrentOffset);
memcpy(mCompleteCode, mRegisters->mCodeChunk, mRegisters->mCurrentOffset);
offset += mRegisters->mCurrentOffset;
set_register(mCompleteCode, LREG_IP, 0);
@ -248,12 +248,12 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp)
set_register(mCompleteCode, LREG_GVR, offset);
memcpy(mCompleteCode + offset, mGlobalVariables->mCodeChunk, mGlobalVariables->mCurrentOffset);
memcpy(mCompleteCode + offset, mGlobalVariables->mCodeChunk, mGlobalVariables->mCurrentOffset); /*Flawfinder: ignore*/
offset += mGlobalVariables->mCurrentOffset;
set_register(mCompleteCode, LREG_GFR, offset);
memcpy(mCompleteCode + offset, mGlobalFunctions->mCodeChunk, mGlobalFunctions->mCurrentOffset);
memcpy(mCompleteCode + offset, mGlobalFunctions->mCodeChunk, mGlobalFunctions->mCurrentOffset); /*Flawfinder: ignore*/
offset += mGlobalFunctions->mCurrentOffset;
set_register(mCompleteCode, LREG_SR, offset);
@ -272,12 +272,12 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp)
}
set_event_register(mCompleteCode, LREG_ER, bytestream2u64(mStates->mCodeChunk, default_state_offset), LSL2_CURRENT_MAJOR_VERSION);
memcpy(mCompleteCode + offset, mStates->mCodeChunk, mStates->mCurrentOffset);
memcpy(mCompleteCode + offset, mStates->mCodeChunk, mStates->mCurrentOffset); /*Flawfinder: ignore*/
offset += mStates->mCurrentOffset;
set_register(mCompleteCode, LREG_HR, offset);
memcpy(mCompleteCode + offset, mHeap->mCodeChunk, mHeap->mCurrentOffset);
memcpy(mCompleteCode + offset, mHeap->mCodeChunk, mHeap->mCurrentOffset); /*Flawfinder: ignore*/
offset += mHeap->mCurrentOffset;
set_register(mCompleteCode, LREG_HP, offset);

View File

@ -26,13 +26,13 @@ void LLScriptFilePosition::fdotabs(FILE *fp, S32 tabs, S32 tabsize)
}
}
char *gWarningText[LSWARN_EOF] =
char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"Dead code found beyond return statement"
};
char *gErrorText[LSERROR_EOF] =
char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"Syntax error",

View File

@ -34,9 +34,9 @@ LLScriptHeapEntry::~LLScriptHeapEntry()
void LLScriptHeapEntry::addString(char *string)
{
S32 size = strlen(string) + 1;
S32 size = strlen(string) + 1; /*Flawfinder: ignore*/
S32 offset = 0;
memcpy(mData, string, size);
memcpy(mData, string, size); /*Flawfinder: ignore*/
mNext += size;
integer2bytestream(mEntry, offset, mNext);
mRefCount++;

View File

@ -26,7 +26,7 @@ typedef enum e_lscript_identifier_type
LIT_EOF
} LSCRIPTIdentifierType;
const char LSCRIPTFunctionTypeStrings[LST_EOF] =
const char LSCRIPTFunctionTypeStrings[LST_EOF] = /*Flawfinder: ignore*/
{
'0',
'i',
@ -39,7 +39,7 @@ const char LSCRIPTFunctionTypeStrings[LST_EOF] =
'0'
};
const char * const LSCRIPTListDescription[LST_EOF] =
const char * const LSCRIPTListDescription[LST_EOF] = /*Flawfinder: ignore*/
{
"PUSHARGB 0",
"PUSHARGB 1",
@ -52,7 +52,7 @@ const char * const LSCRIPTListDescription[LST_EOF] =
"PUSHARGB 0"
};
const char * const LSCRIPTTypePush[LST_EOF] =
const char * const LSCRIPTTypePush[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"PUSHE",
@ -65,7 +65,7 @@ const char * const LSCRIPTTypePush[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeReturn[LST_EOF] =
const char * const LSCRIPTTypeReturn[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"LOADP -12",
@ -78,7 +78,7 @@ const char * const LSCRIPTTypeReturn[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypePop[LST_EOF] =
const char * const LSCRIPTTypePop[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"POP",
@ -91,7 +91,7 @@ const char * const LSCRIPTTypePop[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeDuplicate[LST_EOF] =
const char * const LSCRIPTTypeDuplicate[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"DUP",
@ -104,7 +104,7 @@ const char * const LSCRIPTTypeDuplicate[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeLocalStore[LST_EOF] =
const char * const LSCRIPTTypeLocalStore[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"STORE ",
@ -117,7 +117,7 @@ const char * const LSCRIPTTypeLocalStore[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeLocalDeclaration[LST_EOF] =
const char * const LSCRIPTTypeLocalDeclaration[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"STOREP ",
@ -130,7 +130,7 @@ const char * const LSCRIPTTypeLocalDeclaration[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeGlobalStore[LST_EOF] =
const char * const LSCRIPTTypeGlobalStore[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"STOREG ",
@ -143,7 +143,7 @@ const char * const LSCRIPTTypeGlobalStore[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeLocalPush[LST_EOF] =
const char * const LSCRIPTTypeLocalPush[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"PUSH ",
@ -156,7 +156,7 @@ const char * const LSCRIPTTypeLocalPush[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeLocalPush1[LST_EOF] =
const char * const LSCRIPTTypeLocalPush1[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"PUSHARGI 1",
@ -169,7 +169,7 @@ const char * const LSCRIPTTypeLocalPush1[LST_EOF] =
"undefined"
};
const char * const LSCRIPTTypeGlobalPush[LST_EOF] =
const char * const LSCRIPTTypeGlobalPush[LST_EOF] = /*Flawfinder: ignore*/
{
"INVALID",
"PUSHG ",
@ -194,7 +194,7 @@ public:
{
if (!mString)
return LST_NULL;
S32 length = (S32)strlen(mString);
S32 length = (S32)strlen(mString); /*Flawfinder: ignore*/
if (count >= length)
{
return LST_NULL;
@ -225,9 +225,9 @@ public:
S32 count = 0;
if (mString)
{
count = (S32)strlen(mString);
count = (S32)strlen(mString); /*Flawfinder: ignore*/
char *temp = new char[count + 2];
memcpy(temp, mString, count);
memcpy(temp, mString, count); /*Flawfinder: ignore*/
delete [] mString;
mString = temp;
mString[count + 1] = 0;
@ -243,7 +243,7 @@ public:
S32 getNumber()
{
if (mString)
return (S32)strlen(mString);
return (S32)strlen(mString); /*Flawfinder: ignore*/
else
return 0;
}

View File

@ -251,7 +251,7 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
break;
case LSCP_EMIT_ASSEMBLY:
fprintf(fp, "PUSHARGS \"%s\"\n", mValue);
fprintf(fp, "STACKTOS %lu\n", strlen(mValue) + 1);
fprintf(fp, "STACKTOS %lu\n", strlen(mValue) + 1); /*Flawfinder: ignore*/
break;
case LSCP_TYPE:
type = mType;
@ -271,7 +271,7 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
case LSCP_TO_STACK:
{
chunk->addByte(LSCRIPTOpCodes[LOPC_PUSHARGS]);
chunk->addBytes(mValue, (S32)strlen(mValue) + 1);
chunk->addBytes(mValue, (S32)strlen(mValue) + 1); /*Flawfinder: ignore*/
type = mType;
}
break;
@ -291,7 +291,7 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
S32 LLScriptConstantString::getSize()
{
return (S32)strlen(mValue) + 1;
return (S32)strlen(mValue) + 1; /*Flawfinder: ignore*/
}
@ -1142,7 +1142,7 @@ void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
// it also includes the name of the variable as well as the type
// plus 4 bytes of offset from it's apparent address to the actual data
#ifdef LSL_INCLUDE_DEBUG_INFO
count += strlen(mIdentifier->mName) + 1 + 1 + 4;
count += strlen(mIdentifier->mName) + 1 + 1 + 4; /*Flawfinder: ignore*/
#else
count += 1 + 1 + 4;
#endif
@ -1165,7 +1165,7 @@ void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
chunk->addBytes(&vtype, 1);
// null terminated name
#ifdef LSL_INCLUDE_DEBUG_INFO
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1);
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/
#else
chunk->addBytes(1);
#endif
@ -1296,7 +1296,7 @@ void LLScriptStateEntryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "state_entry";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1332,7 +1332,7 @@ void LLScriptStateExitEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "state_exit";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1390,8 +1390,8 @@ void LLScriptTouchStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "touch_start";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1448,8 +1448,8 @@ void LLScriptTouchEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "touch";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1506,8 +1506,8 @@ void LLScriptTouchEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "touch_end";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1564,8 +1564,8 @@ void LLScriptCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRI
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "collision_start";
chunk->addBytes(name, (S32)strlen(name) + 1);
chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1);
chunk->addBytes(name, (S32)strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1622,8 +1622,8 @@ void LLScriptCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "collision";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1680,8 +1680,8 @@ void LLScriptCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "collision_end";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1737,8 +1737,8 @@ void LLScriptLandCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, L
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "land_collision_start";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1796,8 +1796,8 @@ void LLScriptLandCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "land_collision";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1853,9 +1853,9 @@ void LLScriptLandCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSC
case LSCP_EMIT_BYTE_CODE:
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "land_collision_end";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1);
char name[] = "land_collision_end"; /*Flawfinder: ignore*/
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1912,8 +1912,8 @@ void LLScriptInventoryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "changed";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -1969,8 +1969,8 @@ void LLScriptAttachEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "attach";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2039,9 +2039,9 @@ void LLScriptDataserverEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "dataserver";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mID->mName, strlen(mID->mName) + 1);
chunk->addBytes(mData->mName, strlen(mData->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mData->mName, strlen(mData->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2077,7 +2077,7 @@ void LLScriptTimerEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "timer";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2108,7 +2108,7 @@ void LLScriptMovingStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTC
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "moving_start";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2139,7 +2139,7 @@ void LLScriptMovingEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "moving_end";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2193,8 +2193,8 @@ void LLScriptRTPEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "chat";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2289,11 +2289,11 @@ void LLScriptChatEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "chat";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1);
chunk->addBytes(mName->mName, strlen(mName->mName) + 1);
chunk->addBytes(mID->mName, strlen(mID->mName) + 1);
chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2352,8 +2352,8 @@ void LLScriptSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "sensor";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2409,8 +2409,8 @@ void LLScriptObjectRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "sensor";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mID->mName, strlen(mID->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2492,10 +2492,10 @@ void LLScriptControlEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "control";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mName->mName, strlen(mName->mName) + 1);
chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1);
chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2592,11 +2592,11 @@ void LLScriptLinkMessageEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTC
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "link_message";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1);
chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1);
chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1);
chunk->addBytes(mID->mName, strlen(mID->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2720,13 +2720,13 @@ void LLScriptRemoteEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "remote_event";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mType->mName, strlen(mType->mName) + 1);
chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1);
chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1);
chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1);
chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1);
chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mType->mName, strlen(mType->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2835,11 +2835,11 @@ void LLScriptHTTPResponseEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "http_response";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1);
chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1);
chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1);
chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -2913,9 +2913,9 @@ void LLScriptMoneyEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "money";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mName->mName, strlen(mName->mName) + 1);
chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3024,12 +3024,12 @@ void LLScriptEmailEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "email";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1);
chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1);
chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1);
chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1);
chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3089,8 +3089,8 @@ void LLScriptRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "rez";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3125,7 +3125,7 @@ void LLScriptNoSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "no_sensor";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3204,11 +3204,11 @@ void LLScriptAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa
case LSCP_EMIT_BYTE_CODE:
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "at_target";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1);
chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1);
chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1);
char name[] = "at_target"; /*Flawfinder: ignore*/
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3246,8 +3246,8 @@ void LLScriptNotAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
case LSCP_EMIT_BYTE_CODE:
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "not_at_target";
chunk->addBytes(name, strlen(name) + 1);
char name[] = "not_at_target"; /*Flawfinder: ignore*/
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3327,10 +3327,10 @@ void LLScriptAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "at_rot_target";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1);
chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1);
chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1); /*Flawfinder: ignore*/
chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -3369,7 +3369,7 @@ void LLScriptNotAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
{
#ifdef LSL_INCLUDE_DEBUG_INFO
char name[] = "not_at_rot_target";
chunk->addBytes(name, strlen(name) + 1);
chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
#endif
}
break;
@ -7124,7 +7124,7 @@ void LLScriptFunctionCall::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi
gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR);
}
}
else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString))
else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString)) /*Flawfinder: ignore*/
{
gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR);
}
@ -7440,7 +7440,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry)
if (entry->mLocals.mString)
{
number = (S32)strlen(entry->mLocals.mString);
number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/
for (i = number - 1; i >= 0; i--)
{
switch(entry->mLocals.getType(i))
@ -7473,7 +7473,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry)
if (entry->mFunctionArgs.mString)
{
number = (S32)strlen(entry->mFunctionArgs.mString);
number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/
for (i = number - 1; i >= 0; i--)
{
switch(entry->mFunctionArgs.getType(i))
@ -7512,7 +7512,7 @@ void print_exit_pops(FILE *fp, LLScriptScopeEntry *entry)
if (entry->mLocals.mString)
{
number = (S32)strlen(entry->mLocals.mString);
number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/
for (i = number - 1; i >= 0; i--)
{
fprintf(fp, "%s", LSCRIPTTypePop[entry->mLocals.getType(i)]);
@ -7521,7 +7521,7 @@ void print_exit_pops(FILE *fp, LLScriptScopeEntry *entry)
if (entry->mFunctionArgs.mString)
{
number = (S32)strlen(entry->mFunctionArgs.mString);
number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/
for (i = number - 1; i >= 0; i--)
{
fprintf(fp, "%s", LSCRIPTTypePop[entry->mFunctionArgs.getType(i)]);
@ -7966,8 +7966,8 @@ void LLScriptIf::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pas
break;
case LSCP_EMIT_BYTE_CODE:
{
char jumpname[32];
sprintf(jumpname, "##Temp Jump %d##", gTempJumpCount++);
char jumpname[32]; /*Flawfinder: ignore*/
snprintf(jumpname, sizeof(jumpname),"##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
chunk->addByte(LSCRIPTOpCodes[LOPC_JUMPNIF]);
@ -8047,10 +8047,10 @@ void LLScriptIfElse::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
break;
case LSCP_EMIT_BYTE_CODE:
{
char jumpname1[32];
sprintf(jumpname1, "##Temp Jump %d##", gTempJumpCount++);
char jumpname2[32];
sprintf(jumpname2, "##Temp Jump %d##", gTempJumpCount++);
char jumpname1[32]; /*Flawfinder: ignore*/
snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
char jumpname2[32]; /*Flawfinder: ignore*/
snprintf(jumpname2, sizeof(jumpname2), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
chunk->addByte(LSCRIPTOpCodes[LOPC_JUMPNIF]);
@ -8150,10 +8150,10 @@ void LLScriptFor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pa
break;
case LSCP_EMIT_BYTE_CODE:
{
char jumpname1[32];
sprintf(jumpname1, "##Temp Jump %d##", gTempJumpCount++);
char jumpname2[32];
sprintf(jumpname2, "##Temp Jump %d##", gTempJumpCount++);
char jumpname1[32]; /*Flawfinder: ignore*/
snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
char jumpname2[32]; /*Flawfinder: ignore*/
snprintf(jumpname2, sizeof(jumpname2), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
if(mSequence)
mSequence->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@ -8247,8 +8247,8 @@ void LLScriptDoWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas
break;
case LSCP_EMIT_BYTE_CODE:
{
char jumpname1[32];
sprintf(jumpname1, "##Temp Jump %d##", gTempJumpCount++);
char jumpname1[32]; /*Flawfinder: ignore*/
snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
chunk->addLabel(jumpname1);
mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@ -8321,10 +8321,10 @@ void LLScriptWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
break;
case LSCP_EMIT_BYTE_CODE:
{
char jumpname1[32];
sprintf(jumpname1, "##Temp Jump %d##", gTempJumpCount++);
char jumpname2[32];
sprintf(jumpname2, "##Temp Jump %d##", gTempJumpCount++);
char jumpname1[32]; /*Flawfinder: ignore*/
snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
char jumpname2[32]; /*Flawfinder: ignore*/
snprintf(jumpname2, sizeof(jumpname2), "##Temp Jump %d##", gTempJumpCount++); /*Flawfinder: ignore*/
chunk->addLabel(jumpname1);
mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@ -8999,7 +8999,7 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi
fprintf(fp, ".method public hidebysig instance default void ");
// Mangle event handler name by prefixing it with state name. Allows state changing by finding handlers prefixed with new state name.
fprintf(fp, entry->mIdentifier);
fprintf(fp, entry->mIdentifier); /*Flawfinder: ignore*/
// Handler name and arguments.
mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@ -9135,7 +9135,7 @@ void LLScriptFunctionDec::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil
chunk->addBytes(&typereturn, 1);
// name
#ifdef LSL_INCLUDE_DEBUG_INFO
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1);
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/
#else
chunk->addBytes(1);
#endif
@ -9372,7 +9372,7 @@ void LLScriptGlobalFunctions::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo
// null terminated function name
#ifdef LSL_INCLUDE_DEBUG_INFO
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1);
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/
#else
chunk->addBytes(1);
#endif
@ -9623,7 +9623,7 @@ void LLScriptState::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
// null terminated state name
#ifdef LSL_INCLUDE_DEBUG_INFO
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1);
chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/
#else
chunk->addBytes(1);
#endif
@ -9678,8 +9678,8 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals,
mStates(states), mGlobalScope(NULL), mGlobals(NULL), mGlobalFunctions(NULL), mGodLike(FALSE)
{
const char DEFAULT_BYTECODE_FILENAME[] = "lscript.lso";
strcpy(mBytecodeDest, DEFAULT_BYTECODE_FILENAME);
strncpy(mBytecodeDest, DEFAULT_BYTECODE_FILENAME, sizeof(mBytecodeDest) -1); /*Flawfinder: ignore*/
mBytecodeDest[MAX_STRING-1] = '\0';
LLScriptGlobalVariable *tvar;
LLScriptGlobalFunctions *tfunc;
LLScritpGlobalStorage *temp;
@ -9725,7 +9725,7 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals,
void LLScriptScript::setBytecodeDest(const char* dst_filename)
{
strncpy(mBytecodeDest, dst_filename, MAX_STRING);
strncpy(mBytecodeDest, dst_filename, MAX_STRING); /*Flawfinder: ignore*/
mBytecodeDest[MAX_STRING-1] = '\0';
}
@ -9734,7 +9734,7 @@ void print_cil_globals(FILE* fp, LLScriptGlobalVariable* global)
fprintf(fp, ".field private ");
print_cil_type(fp, global->mType->mType);
fprintf(fp, " ");
fprintf(fp, global->mIdentifier->mName);
fprintf(fp, global->mIdentifier->mName); /*Flawfinder: ignore*/
fprintf(fp, "\n");
if(NULL != global->mNextp)
{
@ -9913,7 +9913,7 @@ void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
// now, put it all together and spit it out
// we need
FILE *bcfp = LLFile::fopen(mBytecodeDest, "wb");
FILE* bcfp = LLFile::fopen(mBytecodeDest, "wb"); /*Flawfinder: ignore*/
code->build(fp, bcfp);
fclose(bcfp);

View File

@ -2248,7 +2248,7 @@ public:
BOOL mGodLike;
private:
char mBytecodeDest[MAX_STRING];
char mBytecodeDest[MAX_STRING]; /*Flawfinder: ignore*/
};
class LLScriptAllocationManager

View File

@ -20,7 +20,7 @@
void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode);
void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode);
char *LSCRIPTRunTimeFaultStrings[LSRF_EOF] =
char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/
{
"invalid", // LSRF_INVALID,
"Math Error", // LSRF_MATH,
@ -2643,7 +2643,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
if (strlen(sdata))
if (strlen(sdata)) /*Flawfinder: ignore*/
{
offset += arg;
}
@ -2669,7 +2669,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
if (strlen(sdata))
if (strlen(sdata)) /*Flawfinder: ignore*/
{
LLUUID id;
id.set(sdata);
@ -2758,7 +2758,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
if (!strlen(sdata))
if (!strlen(sdata)) /*Flawfinder: ignore*/
{
offset += arg;
}
@ -2784,7 +2784,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 size = toffset - string;
char *sdata = new char[size];
bytestream2char(sdata, buffer, string);
if (strlen(sdata))
if (strlen(sdata)) /*Flawfinder: ignore*/
{
LLUUID id;
id.set(sdata);
@ -2935,7 +2935,7 @@ S32 axtoi(char *hexStg)
BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
{
char caststr[1024];
char caststr[1024]; /*Flawfinder: ignore*/
if (b_print)
printf("[0x%X]\tCAST ", offset);
offset++;
@ -2968,7 +2968,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
case LST_STRING:
{
S32 address, source = lscript_pop_int(buffer);
sprintf(caststr, "%d", source);
snprintf(caststr, sizeof(caststr), "%d", source); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@ -3005,7 +3005,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
{
S32 address;
F32 source = lscript_pop_float(buffer);
sprintf(caststr, "%f", source);
snprintf(caststr, sizeof(caststr), "%f", source); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@ -3214,7 +3214,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 address;
LLVector3 source;
lscript_pop_vector(buffer, source);
sprintf(caststr, "<%5.5f, %5.5f, %5.5f>", source.mV[VX], source.mV[VY], source.mV[VZ]);
snprintf(caststr, sizeof(caststr), "<%5.5f, %5.5f, %5.5f>", source.mV[VX], source.mV[VY], source.mV[VZ]); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@ -3247,7 +3247,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
S32 address;
LLQuaternion source;
lscript_pop_quaternion(buffer, source);
sprintf(caststr, "<%5.5f, %5.5f, %5.5f, %5.5f>", source.mQ[VX], source.mQ[VY], source.mQ[VZ], source.mQ[VS]);
snprintf(caststr, sizeof(caststr), "<%5.5f, %5.5f, %5.5f, %5.5f>", source.mQ[VX], source.mQ[VY], source.mQ[VZ], source.mQ[VS]); /*Flawfinder: ignore*/
address = lsa_heap_add_data(buffer, new LLScriptLibData(caststr), get_max_heap_size(buffer), TRUE);
lscript_push(buffer, address);
}
@ -3571,22 +3571,29 @@ void lscript_run(char *filename, BOOL b_debug)
char *error;
BOOL b_state;
LLScriptExecute *execute = NULL;
FILE *file = LLFile::fopen(filename, "r");
if (filename == NULL)
{
llerrs << "filename is empty" << llendl;
// Just reporting error is likely not enough. Need
// to check how to abort or error out gracefully
// from this function. XXXTBD
}
FILE* file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
if (file)
{
execute = new LLScriptExecute(file);
fclose(file);
}
file = LLFile::fopen(filename, "r");
file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
if (file)
{
FILE *fp = LLFile::fopen("lscript.parse", "w");
FILE* fp = LLFile::fopen("lscript.parse", "w"); /*Flawfinder: ignore*/
LLScriptLSOParse *parse = new LLScriptLSOParse(file);
parse->printData(fp);
fclose(file);
fclose(fp);
}
file = LLFile::fopen(filename, "r");
file = LLFile::fopen(filename, "r"); /*Flawfinder: ignore*/
if (file && execute)
{
timer.reset();
@ -3795,7 +3802,7 @@ BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
if (gScriptLibrary.mFunctions[arg]->mArgs)
{
number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs);
number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/
arguments = new LLScriptLibData[number];
}
else
@ -3866,7 +3873,7 @@ BOOL run_calllib_two_byte(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &i
if (gScriptLibrary.mFunctions[arg]->mArgs)
{
number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs);
number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/
arguments = new LLScriptLibData[number];
}
else

View File

@ -103,7 +103,7 @@ void LLScriptLSOParse::printGlobals(FILE *fp)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
char name[256];
char name[256]; /*Flawfinder: ignore*/
U8 type;
S32 global_v_offset = get_register(mRawData, LREG_GVR);
@ -171,7 +171,7 @@ void LLScriptLSOParse::printGlobalFunctions(FILE *fp)
S32 i, offset;
// LLVector3 vvalue; unused
// LLQuaternion qvalue; unused
char name[256];
char name[256]; /*Flawfinder: ignore*/
U8 type;
offset = get_register(mRawData, LREG_GFR);
@ -261,7 +261,7 @@ void LLScriptLSOParse::printStates(FILE *fp)
U32 j, k;
// LLVector3 vvalue; unused
// LLQuaternion qvalue; unused
char name[256];
char name[256]; /*Flawfinder: ignore*/
S32 state_offset = get_register(mRawData, LREG_SR);
@ -1177,7 +1177,7 @@ void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs)
void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs)
{
char arg[1024];
char arg[1024]; /*Flawfinder: ignore*/
lso_print_tabs(fp, tabs);
fprintf(fp, "[0x%X]\tPUSHARGS ", offset++);
bytestream2char(arg, buffer, offset);

View File

@ -163,10 +163,10 @@ public:
size += 4;
break;
case LST_KEY:
size += (S32)strlen(mKey) + 1;
size += (S32)strlen(mKey) + 1; /*Flawfinder: ignore*/
break;
case LST_STRING:
size += (S32)strlen(mString) + 1;
size += (S32)strlen(mString) + 1; /*Flawfinder: ignore*/
break;
case LST_LIST:
break;
@ -222,19 +222,29 @@ public:
{
if (data.mKey)
{
mKey = new char[strlen(data.mKey) + 1];
strcpy(mKey, data.mKey);
mKey = new char[strlen(data.mKey) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mKey, data.mKey); /* Flawfinder: ignore */
}
if (data.mString)
{
mString = new char[strlen(data.mString) + 1];
strcpy(mString, data.mString);
mString = new char[strlen(data.mString) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, data.mString); /* Flawfinder: ignore */
}
}
LLScriptLibData(U8 *src, S32 &offset) : mListp(NULL)
{
static char temp[TOP_OF_MEMORY];
static char temp[TOP_OF_MEMORY]; /* Flawfinder: ignore */
mType = (LSCRIPTType)bytestream2integer(src, offset);
switch(mType)
{
@ -247,15 +257,25 @@ public:
case LST_KEY:
{
bytestream2char(temp, src, offset);
mKey = new char[strlen(temp) + 1];
strcpy(mKey, temp);
mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mKey, temp); /* Flawfinder: ignore */
}
break;
case LST_STRING:
{
bytestream2char(temp, src, offset);
mString = new char[strlen(temp) + 1];
strcpy(mString, temp);
mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, temp); /* Flawfinder: ignore */
}
break;
case LST_LIST:
@ -273,7 +293,7 @@ public:
void set(U8 *src, S32 &offset)
{
static char temp[TOP_OF_MEMORY];
static char temp[TOP_OF_MEMORY]; /* Flawfinder: ignore */
mType = (LSCRIPTType)bytestream2integer(src, offset);
switch(mType)
{
@ -286,15 +306,25 @@ public:
case LST_KEY:
{
bytestream2char(temp, src, offset);
mKey = new char[strlen(temp) + 1];
strcpy(mKey, temp);
mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mKey, temp); /* Flawfinder: ignore */
}
break;
case LST_STRING:
{
bytestream2char(temp, src, offset);
mString = new char[strlen(temp) + 1];
strcpy(mString, temp);
mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, temp); /* Flawfinder: ignore */
}
break;
case LST_LIST:
@ -316,8 +346,13 @@ public:
void setFromCSV(char *src)
{
mType = LST_STRING;
mString = new char[strlen(src) + 1];
strcpy(mString, src);
mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, src); /* Flawfinder: ignore */
}
LLScriptLibData(S32 integer) : mType(LST_INTEGER), mInteger(integer), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL)
@ -343,8 +378,13 @@ public:
}
else
{
mString = new char[strlen(string) + 1];
strcpy(mString, string);
mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, string); /* Flawfinder: ignore */
}
}
@ -357,8 +397,13 @@ public:
}
else
{
mString = new char[strlen(string) + 1];
strcpy(mString, string);
mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
strcpy(mString, string); /* Flawfinder: ignore */
}
}

View File

@ -108,10 +108,10 @@ S32 lsa_heap_add_data(U8 *buffer, LLScriptLibData *data, S32 heapsize, BOOL b_de
size = 4;
break;
case LST_KEY:
size = (S32)strlen(data->mKey) + 1;
size = (S32)strlen(data->mKey) + 1; /*Flawfinder: ignore*/
break;
case LST_STRING:
size = (S32)strlen(data->mString) + 1;
size = (S32)strlen(data->mString) + 1; /*Flawfinder: ignore*/
break;
case LST_LIST:
// list data 4 bytes of number of entries followed by number of pointer
@ -335,7 +335,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
{
if (data->mString)
{
size = (S32)strlen(data->mString) + 1;
size = (S32)strlen(data->mString) + 1; /*Flawfinder: ignore*/
}
else
{
@ -346,7 +346,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
{
if (data->mKey)
{
size = (S32)strlen(data->mKey) + 1;
size = (S32)strlen(data->mKey) + 1; /*Flawfinder: ignore*/
}
else
{
@ -413,8 +413,12 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
if (listsize)
{
U8 *tbuff = new U8[size + listsize];
memcpy(tbuff, *buffer, size);
memcpy(tbuff + size, listbuf, listsize);
if (tbuff == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
}
memcpy(tbuff, *buffer, size); /*Flawfinder: ignore*/
memcpy(tbuff + size, listbuf, listsize); /*Flawfinder: ignore*/
size += listsize;
delete [] *buffer;
delete [] listbuf;
@ -497,7 +501,7 @@ void lsa_decrease_ref_count(U8 *buffer, S32 offset)
alloc_entry2bytestream(buffer, orig_offset, entry);
}
char gLSAStringRead[16384];
char gLSAStringRead[16384]; /*Flawfinder: ignore*/
LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref)
@ -538,13 +542,13 @@ LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref)
break;
case LST_KEY:
bytestream2char(gLSAStringRead, buffer, offset);
retval->mKey = new char[strlen(gLSAStringRead) + 1];
strcpy(retval->mKey, gLSAStringRead);
retval->mKey = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/
strcpy(retval->mKey, gLSAStringRead); /*Flawfinder: ignore*/
break;
case LST_STRING:
bytestream2char(gLSAStringRead, buffer, offset);
retval->mString = new char[strlen(gLSAStringRead) + 1];
strcpy(retval->mString, gLSAStringRead);
retval->mString = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/
strcpy(retval->mString, gLSAStringRead); /*Flawfinder: ignore*/
break;
case LST_VECTOR:
bytestream2vector(retval->mVec, buffer, offset);
@ -684,13 +688,13 @@ S32 lsa_cat_strings(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
return 0;
}
S32 size = (S32)strlen(test1) + (S32)strlen(test2) + 1;
S32 size = (S32)strlen(test1) + (S32)strlen(test2) + 1; /*Flawfinder: ignore*/
LLScriptLibData *string3 = new LLScriptLibData;
string3->mType = LST_STRING;
string3->mString = new char[size];
strcpy(string3->mString, test1);
strcat(string3->mString, test2);
strcpy(string3->mString, test1); /*Flawfinder: ignore*/
strcat(string3->mString, test2); /*Flawfinder: ignore*/
delete string1;
delete string2;
@ -760,7 +764,7 @@ void lsa_print_heap(U8 *buffer)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
char string[4096];
char string[4096]; /*Flawfinder: ignore*/
LLScriptAllocEntry entry;
@ -830,7 +834,7 @@ void lsa_fprint_heap(U8 *buffer, FILE *fp)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
char string[4096];
char string[4096]; /*Flawfinder: ignore*/
LLScriptAllocEntry entry;

View File

@ -433,11 +433,17 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun
mDesc = new char[512];
if (mSleepTime)
{
sprintf(mDesc,"%s\nSleeps script for %.1f seconds.",desc,mSleepTime);
snprintf( /* Flawfinder: ignore */
mDesc,
512,
"%s\nSleeps script for %.1f seconds.",
desc,
mSleepTime);
}
else
{
strcpy(mDesc,desc);
strncpy(mDesc, desc, 512); /* Flawfinder: ignore */
mDesc[511] = '\0'; // just in case.
}
}
@ -451,7 +457,10 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func)
LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1];
if (mNextNumber)
{
memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber);
memcpy( /* Flawfinder: ignore */
temp,
mFunctions,
sizeof(LLScriptLibraryFunction*)*mNextNumber);
delete [] mFunctions;
}
mFunctions = temp;
@ -473,7 +482,7 @@ void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *
void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
{
char tmp[1024];
char tmp[1024]; /*Flawfinder: ignore*/
if (b_prepend_comma)
{
s << ", ";
@ -484,7 +493,7 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
s << mInteger;
break;
case LST_FLOATINGPOINT:
snprintf(tmp, 1024, "%f", mFP);
snprintf(tmp, 1024, "%f", mFP); /*Flawfinder: ignore*/
s << tmp;
break;
case LST_KEY:
@ -494,12 +503,12 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
s << mString;
break;
case LST_VECTOR:
snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
mVec.mV[VY], mVec.mV[VZ]);
s << tmp;
break;
case LST_QUATERNION:
snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
mQuat.mQ[VZ], mQuat.mQ[VS]);
s << tmp;
break;
@ -517,7 +526,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
//print(ostr, FALSE);
{
BOOL b_prepend_comma = FALSE;
char tmp[1024];
char tmp[1024]; /* Flawfinder: ignore */
if (b_prepend_comma)
{
ostr << ", ";
@ -528,7 +537,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
ostr << mInteger;
break;
case LST_FLOATINGPOINT:
snprintf(tmp, 1024, "%f", mFP);
snprintf(tmp, 1024, "%f", mFP); /* Flawfinder: ignore */
ostr << tmp;
break;
case LST_KEY:
@ -538,12 +547,12 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
ostr << mString;
break;
case LST_VECTOR:
snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
mVec.mV[VY], mVec.mV[VZ]);
ostr << tmp;
break;
case LST_QUATERNION:
snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
mQuat.mQ[VZ], mQuat.mQ[VS]);
ostr << tmp;
break;

View File

@ -81,7 +81,7 @@ OSStatus dialogHandler(EventHandlerCallRef handler, EventRef event, void *userda
{
case kHICommandOK:
{
char buffer[65535];
char buffer[65535]; /* Flawfinder: ignore */
Size size = sizeof(buffer) - 1;
ControlRef textField = NULL;
ControlID id;
@ -315,9 +315,9 @@ int main(int argc, char **argv)
// *NOTE: changing the size of either of these buffers will
// require changing the sscanf() format string to correctly
// account for it.
char tmp_sl_name[LL_MAX_PATH];
char tmp_sl_name[LL_MAX_PATH]; /* Flawfinder: ignore */
tmp_sl_name[0] = '\0';
char tmp_space[MAX_STRING];
char tmp_space[MAX_STRING]; /* Flawfinder: ignore */
tmp_space[0] = '\0';
// Look for it in the debug_info.log file
@ -376,7 +376,7 @@ int main(int argc, char **argv)
// MBW -- This needs to go find "~/Library/Logs/CrashReporter/Second Life.crash.log" on 10.3
// or "~/Library/Logs/Second Life.crash.log" on 10.2.
{
char path[MAX_PATH];
char path[MAX_PATH]; /* Flawfinder: ignore */
FSRef folder;
if(FSFindFolder(kUserDomain, kLogsFolderType, false, &folder) == noErr)
@ -577,7 +577,7 @@ LLFileEncoder::LLFileEncoder(const char *form_name, const char *filename, bool i
}
S32 buf_size = stat_data.st_size;
FILE *fp = fopen(mFilename.c_str(), "rb");
FILE* fp = fopen(mFilename.c_str(), "rb"); /* Flawfinder: ignore */
U8 *buf = new U8[buf_size + 1];
fread(buf, 1, buf_size, fp);
fclose(fp);
@ -598,7 +598,7 @@ LLFileEncoder::LLFileEncoder(const char *form_name, const char *filename, bool i
while(temp != NULL)
{
// Skip past the marker we just found
cur = temp + strlen(sep);
cur = temp + strlen(sep); /* Flawfinder: ignore */
// and try to find another
temp = strstr(cur, sep);
@ -638,11 +638,15 @@ LLString LLFileEncoder::encodeURL(const S32 max_length)
S32 buf_size = mBuf.size();
S32 url_buf_size = 3*mBuf.size() + 1;
char *url_buf = new char[url_buf_size];
if (url_buf == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return result;
}
S32 cur_pos = 0;
for (; i < buf_size; i++)
{
sprintf(url_buf + cur_pos, "%%%02x", mBuf[i]);
sprintf(url_buf + cur_pos, "%%%02x", mBuf[i]); /* Flawfinder: ignore */
cur_pos += 3;
}
url_buf[i*3] = 0;
@ -661,12 +665,17 @@ LLString encode_string(const char *formname, const LLString &str)
S32 buf_size = str.size();
S32 url_buf_size = 3*str.size() + 1;
char *url_buf = new char[url_buf_size];
if (url_buf == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return result;
}
S32 cur_pos = 0;
S32 i;
for (i = 0; i < buf_size; i++)
{
sprintf(url_buf + cur_pos, "%%%02x", str[i]);
sprintf(url_buf + cur_pos, "%%%02x", str[i]); /* Flawfinder: ignore */
cur_pos += 3;
}
url_buf[i*3] = 0;

View File

@ -48,7 +48,7 @@ Boolean gCancelled = false;
char *gUserServer;
char *gProductName;
char gUpdateURL[2048];
char gUpdateURL[2048]; /* Flawfinder: ignore */
void *updatethreadproc(void*);
@ -362,7 +362,7 @@ int main(int argc, char **argv)
llinfos << "Starting " << gProductName << " Updater" << llendl;
// Build the URL to download the update
snprintf(gUpdateURL, sizeof(gUpdateURL), "http://secondlife.com/update-macos.php?userserver=%s", gUserServer);
snprintf(gUpdateURL, sizeof(gUpdateURL), "http://secondlife.com/update-macos.php?userserver=%s", gUserServer); /* Flawfinder: ignore */
// Real UI...
OSStatus err;
@ -370,8 +370,8 @@ int main(int argc, char **argv)
err = CreateNibReference(CFSTR("AutoUpdater"), &nib);
char windowTitle[MAX_PATH];
snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName);
char windowTitle[MAX_PATH]; /* Flawfinder: ignore */
snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName); /* Flawfinder: ignore */
CFStringRef windowTitleRef = NULL;
windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8);
@ -488,7 +488,7 @@ bool isDirWritable(FSRef &dir)
// This is kinda lame, but will pretty much always give the right answer.
OSStatus err = noErr;
char temp[PATH_MAX];
char temp[PATH_MAX]; /* Flawfinder: ignore */
err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp));
@ -538,15 +538,15 @@ static void utf8str_to_HFSUniStr255(HFSUniStr255 *dest, const char* src)
// Truncate to avoid stack smaching or other badness.
dest->length = 255;
}
memcpy(dest->unicode, utf16str.data(), sizeof(UniChar)* dest->length);
memcpy(dest->unicode, utf16str.data(), sizeof(UniChar)* dest->length); /* Flawfinder: ignore */
}
int restoreObject(const char* aside, const char* target, const char* path, const char* object)
{
char source[PATH_MAX];
char dest[PATH_MAX];
snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object);
snprintf(dest, sizeof(dest), "%s/%s", target, path);
char source[PATH_MAX]; /* Flawfinder: ignore */
char dest[PATH_MAX]; /* Flawfinder: ignore */
snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); /* Flawfinder: ignore */
snprintf(dest, sizeof(dest), "%s/%s", target, path); /* Flawfinder: ignore */
FSRef sourceRef;
FSRef destRef;
OSStatus err;
@ -578,28 +578,28 @@ int restoreObject(const char* aside, const char* target, const char* path, const
// Replace any mention of "Second Life" with the product name.
void filterFile(const char* filename)
{
char temp[PATH_MAX];
char temp[PATH_MAX]; /* Flawfinder: ignore */
// First copy the target's version, so we can run it through sed.
snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename);
system(temp);
snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); /* Flawfinder: ignore */
system(temp); /* Flawfinder: ignore */
// Now run it through sed.
snprintf(temp, sizeof(temp),
snprintf(temp, sizeof(temp), /* Flawfinder: ignore */
"sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename);
system(temp);
system(temp); /* Flawfinder: ignore */
}
void *updatethreadproc(void*)
{
char tempDir[PATH_MAX] = "";
char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */
FSRef tempDirRef;
char temp[PATH_MAX];
char temp[PATH_MAX]; /* Flawfinder: ignore */
// *NOTE: This buffer length is used in a scanf() below.
char deviceNode[1024] = "";
char deviceNode[1024] = ""; /* Flawfinder: ignore */
FILE *downloadFile = NULL;
OSStatus err;
ProcessSerialNumber psn;
char target[PATH_MAX];
char target[PATH_MAX]; /* Flawfinder: ignore */
FSRef targetRef;
FSRef targetParentRef;
FSVolumeRefNum targetVol;
@ -740,7 +740,7 @@ void *updatethreadproc(void*)
throw 0;
}
snprintf(target, sizeof(target), "/Applications/%s.app", gProductName);
snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); /* Flawfinder: ignore */
memset(&targetRef, 0, sizeof(targetRef));
err = FSPathMakeRef((UInt8*)target, &targetRef, NULL);
@ -825,7 +825,7 @@ void *updatethreadproc(void*)
throw 0;
}
strcpy(tempDir, temp);
strcpy(tempDir, temp); /* Flawfinder: ignore */
llinfos << "tempDir is " << tempDir << llendl;
@ -836,9 +836,9 @@ void *updatethreadproc(void*)
chdir(tempDir);
snprintf(temp, sizeof(temp), "SecondLife.dmg");
snprintf(temp, sizeof(temp), "SecondLife.dmg"); /* Flawfinder: ignore */
downloadFile = fopen(temp, "wb");
downloadFile = fopen(temp, "wb"); /* Flawfinder: ignore */
if(downloadFile == NULL)
{
throw 0;
@ -883,7 +883,7 @@ void *updatethreadproc(void*)
// NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder,
// but if our cleanup fails, this makes it much harder for the user to unmount the image.
LLString mountOutput;
FILE *mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r");
FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */
if(mounter == NULL)
{
@ -918,8 +918,8 @@ void *updatethreadproc(void*)
if(sub != NULL)
{
sub += strlen(prefix);
sscanf(sub, "%1023s", deviceNode);
sub += strlen(prefix); /* Flawfinder: ignore */
sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */
}
}
@ -934,7 +934,7 @@ void *updatethreadproc(void*)
// Get an FSRef to the new application on the disk image
FSRef sourceRef;
snprintf(temp, sizeof(temp), "%s/mnt/Second Life.app", tempDir);
snprintf(temp, sizeof(temp), "%s/mnt/Second Life.app", tempDir); /* Flawfinder: ignore */
llinfos << "Source application is: " << temp << llendl;
@ -943,7 +943,7 @@ void *updatethreadproc(void*)
throw 0;
FSRef asideRef;
char aside[MAX_PATH];
char aside[MAX_PATH]; /* Flawfinder: ignore */
// this will hold the name of the destination target
HFSUniStr255 appNameUniStr;
@ -966,8 +966,8 @@ void *updatethreadproc(void*)
else
{
// Construct the name of the target based on the product name
char appName[MAX_PATH];
snprintf(appName, sizeof(appName), "%s.app", gProductName);
char appName[MAX_PATH]; /* Flawfinder: ignore */
snprintf(appName, sizeof(appName), "%s.app", gProductName); /* Flawfinder: ignore */
utf8str_to_HFSUniStr255( &appNameUniStr, appName );
}
@ -1015,8 +1015,8 @@ void *updatethreadproc(void*)
llinfos << "Clearing cache..." << llendl;
char mask[LL_MAX_PATH];
sprintf(mask, "%s*.*", gDirUtilp->getDirDelimiter().c_str());
char mask[LL_MAX_PATH]; /* Flawfinder: ignore */
snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str()); /* Flawfinder: ignore */
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask);
llinfos << "Clear complete." << llendl;
@ -1048,8 +1048,8 @@ void *updatethreadproc(void*)
{
llinfos << "Detaching disk image." << llendl;
snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode);
system(temp);
snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode); /* Flawfinder: ignore */
system(temp); /* Flawfinder: ignore */
}
sendProgress(2, 3);
@ -1073,13 +1073,13 @@ void *updatethreadproc(void*)
{
llinfos << "Touching application bundle." << llendl;
snprintf(temp, sizeof(temp), "touch '%s'", target);
system(temp);
snprintf(temp, sizeof(temp), "touch '%s'", target); /* Flawfinder: ignore */
system(temp); /* Flawfinder: ignore */
llinfos << "Launching updated application." << llendl;
snprintf(temp, sizeof(temp), "open '%s'", target);
system(temp);
snprintf(temp, sizeof(temp), "open '%s'", target); /* Flawfinder: ignore */
system(temp); /* Flawfinder: ignore */
}
sendDone();

View File

@ -768,7 +768,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
// char host_name[MAX_STRING];
// regionp->getHost().getHostName(host_name, MAX_STRING);
char ip[MAX_STRING];
char ip[MAX_STRING]; /*Flawfinder: ignore*/
regionp->getHost().getString(ip, MAX_STRING);
llinfos << "Moving agent into region: " << regionp->getName()
<< " located at " << ip << llendl;
@ -5165,7 +5165,7 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
LLGroupData group;
S32 index = -1;
bool need_floater_update = false;
char group_name[DB_GROUP_NAME_BUF_SIZE];
char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
for(S32 i = 0; i < count; ++i)
{
msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group.mID, i);

View File

@ -648,8 +648,8 @@ public:
U8 mAccess; // SIM_ACCESS_MATURE or SIM_ACCESS_PG
U64 mGroupPowers;
BOOL mHideGroupTitle;
char mGroupTitle[DB_GROUP_TITLE_BUF_SIZE]; // honorific, like "Sir"
char mGroupName[DB_GROUP_NAME_BUF_SIZE];
char mGroupTitle[DB_GROUP_TITLE_BUF_SIZE]; /*Flawfinder: ignore*/ // honorific, like "Sir"
char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
LLUUID mGroupID;
//LLUUID mGroupInsigniaID;
LLUUID mInventoryRootID;

View File

@ -36,13 +36,14 @@ LLAgentPilot::~LLAgentPilot()
void LLAgentPilot::load(const char *filename)
{
llifstream file;
if(!filename) return;
file.open(filename);
llifstream file(filename);
if (!file)
{
llinfos << "Couldn't open " << filename << ", aborting agentpilot load!" << llendl;
lldebugs << "Couldn't open " << filename
<< ", aborting agentpilot load!" << llendl;
return;
}
else
@ -71,7 +72,7 @@ void LLAgentPilot::load(const char *filename)
void LLAgentPilot::save(const char *filename)
{
llofstream file;
file.open(filename);
file.open(filename); /*Flawfinder: ignore*/
if (!file)
{

View File

@ -183,7 +183,7 @@ void LLNewAgentInventoryResponder::result(const LLSD& result)
char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists
if( !end_p )
{
end_p = asset_name_str + strlen( asset_name_str );
end_p = asset_name_str + strlen( asset_name_str ); /*Flawfinder: ignore*/
}
S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) );

View File

@ -243,8 +243,8 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
using namespace std;
U32 new_buddy_count = 0;
char first[DB_FIRST_NAME_BUF_SIZE];
char last[DB_LAST_NAME_BUF_SIZE];
char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
LLUUID agent_id;
for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr)
{
@ -541,8 +541,8 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg)
{
if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS)
{
char first[DB_FIRST_NAME_BUF_SIZE];
char last[DB_LAST_NAME_BUF_SIZE];
char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
LLStringBase<char>::format_map_t args;
if(gCacheName->getName(agent_id, first, last))
{
@ -598,8 +598,8 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
setBuddyOnline(agent_id,online);
if(chat_notify)
{
char first[DB_FIRST_NAME_BUF_SIZE];
char last[DB_LAST_NAME_BUF_SIZE];
char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
if(gCacheName->getName(agent_id, first, last))
{
notify = TRUE;

View File

@ -189,8 +189,8 @@ public:
virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mMappable;
char mFirst[DB_FIRST_NAME_BUF_SIZE];
char mLast[DB_LAST_NAME_BUF_SIZE];
char mFirst[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
char mLast[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
};
// collect dictionary sorted map of name -> agent_id for every online buddy
@ -202,8 +202,8 @@ public:
virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mOnline;
char mFirst[DB_FIRST_NAME_BUF_SIZE];
char mLast[DB_LAST_NAME_BUF_SIZE];
char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
};
// collect dictionary sorted map of name -> agent_id for every buddy,
@ -217,8 +217,8 @@ public:
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mOnline;
buddy_map_t mOffline;
char mFirst[DB_FIRST_NAME_BUF_SIZE];
char mLast[DB_LAST_NAME_BUF_SIZE];
char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
};
#endif // LL_LLCALLINGCARD_H

View File

@ -178,8 +178,8 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id)
BOOL LLFloaterScriptQueue::start()
{
//llinfos << "LLFloaterCompileQueue::start()" << llendl;
char buffer[MAX_STRING];
sprintf(buffer, "Starting %s of %d items.", mStartString, mObjectIDs.count());
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
snprintf(buffer, sizeof(buffer), "Starting %s of %d items.", mStartString, mObjectIDs.count()); /*Flawfinder: ignore*/
LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
list->addSimpleItem(buffer);
@ -218,8 +218,8 @@ BOOL LLFloaterScriptQueue::nextObject()
LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
mDone = TRUE;
char buffer[MAX_STRING];
sprintf(buffer, "Done.");
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
snprintf(buffer, sizeof(buffer), "Done."); /*Flawfinder: ignore*/
list->addSimpleItem(buffer);
childSetEnabled("close",TRUE);
}
@ -268,7 +268,7 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create()
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue",
rect);
new_queue->open();
new_queue->open(); /*Flawfinder: ignore*/
return new_queue;
}
@ -353,25 +353,25 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
if(!data) return;
LLFloaterCompileQueue* queue = static_cast<LLFloaterCompileQueue*>
(LLFloaterScriptQueue::findInstance(data->mQueueID));
char buffer[MAX_STRING];
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
buffer[0] = '\0';
if(queue && (0 == status))
{
//llinfos << "ITEM NAME 3: " << data->mScriptName << llendl;
// Dump this into a file on the local disk so we can compile it.
char filename[LL_MAX_PATH] = "";
char filename[LL_MAX_PATH] = ""; /*Flawfinder: ignore*/
LLVFile file(vfs, asset_id, type);
char uuid_str[UUID_STR_LENGTH];
char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/
asset_id.toString(uuid_str);
sprintf(filename,"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type));
snprintf(filename, sizeof(filename), "%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /*Flawfinder: ignore*/
FILE *fp = LLFile::fopen(filename, "wb");
FILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
if (fp)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size))
while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{
@ -384,7 +384,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
}
// It's now in the file, now compile it.
sprintf(buffer, "Downloaded, now compiling '%s'.", data->mScriptName.c_str());
snprintf(buffer, sizeof(buffer), "Downloaded, now compiling '%s'.", data->mScriptName.c_str()); /*Flawfinder: ignore*/
queue->compile(filename, asset_id);
// Delete it after we're done compiling?
@ -401,19 +401,19 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
{
LLChat chat("Script not found on server.");
LLFloaterChat::addChat(chat);
sprintf(buffer, "Problem downloading %s.",
snprintf(buffer, sizeof(buffer), "Problem downloading %s.", /*Flawfinder: ignore*/
data->mScriptName.c_str());
}
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
{
LLChat chat("Insufficient permissions to download a script.");
LLFloaterChat::addChat(chat);
sprintf(buffer, "Insufficient permissions for '%s'.",
snprintf(buffer, sizeof(buffer), "Insufficient permissions for '%s'.", /*Flawfinder: ignore*/
data->mScriptName.c_str());
}
else
{
sprintf(buffer, "Unknown failure to download %s.",
snprintf(buffer, sizeof(buffer), "Unknown failure to download %s.", /*Flawfinder: ignore*/
data->mScriptName.c_str());
}
@ -474,12 +474,12 @@ void LLFloaterCompileQueue::compile(const char* filename,
tid.generate();
new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
char uuid_string[UUID_STR_LENGTH];
char uuid_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/
new_asset_id.toString(uuid_string);
char dst_filename[LL_MAX_PATH];
sprintf(dst_filename, "%s.lso", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str());
char err_filename[LL_MAX_PATH];
sprintf(err_filename, "%s.out", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str());
char dst_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/
snprintf(dst_filename, sizeof(dst_filename), "%s.lso", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /*Flawfinder: ignore*/
char err_filename[LL_MAX_PATH]; /*Flawfinder: ignore*/
snprintf(err_filename, sizeof(err_filename), "%s.out", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /*Flawfinder: ignore*/
gAssetStorage->storeAssetData(filename, tid,
LLAssetType::AT_LSL_TEXT,
@ -571,7 +571,7 @@ LLFloaterResetQueue* LLFloaterResetQueue::create()
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue",
rect);
new_queue->open();
new_queue->open(); /*Flawfinder: ignore*/
return new_queue;
}
@ -602,8 +602,8 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
{
LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
char buffer[MAX_STRING];
sprintf(buffer, "Resetting '%s'.", item->getName().c_str());
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
snprintf(buffer, sizeof(buffer), "Resetting '%s'.", item->getName().c_str()); /*Flawfinder: ignore*/
list->addSimpleItem(buffer);
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ScriptReset);
@ -634,7 +634,7 @@ LLFloaterRunQueue* LLFloaterRunQueue::create()
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterRunQueue* new_queue = new LLFloaterRunQueue("queue",
rect);
new_queue->open();
new_queue->open(); /*Flawfinder: ignore*/
return new_queue;
}
@ -665,8 +665,8 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
{
LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
char buffer[MAX_STRING];
sprintf(buffer, "Running '%s'.", item->getName().c_str());
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
snprintf(buffer, sizeof(buffer), "Running '%s'.", item->getName().c_str()); /*Flawfinder: ignore*/
list->addSimpleItem(buffer);
LLMessageSystem* msg = gMessageSystem;
@ -699,7 +699,7 @@ LLFloaterNotRunQueue* LLFloaterNotRunQueue::create()
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterNotRunQueue* new_queue = new LLFloaterNotRunQueue("queue",
rect);
new_queue->open();
new_queue->open(); /*Flawfinder: ignore*/
return new_queue;
}
@ -730,8 +730,8 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
{
LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
char buffer[MAX_STRING];
sprintf(buffer, "Not running '%s'.", item->getName().c_str());
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
snprintf(buffer, sizeof(buffer), "Not running '%s'.", item->getName().c_str()); /*Flawfinder: ignore*/
list->addSimpleItem(buffer);
LLMessageSystem* msg = gMessageSystem;

View File

@ -144,7 +144,7 @@ LLDebugVarMessageBox* LLDebugVarMessageBox::show(const std::string& title, EDebu
sInstances[title_string] = box;
gFloaterView->addChild(box);
box->reshape(200,150);
box->open();
box->open(); /*Flawfinder: ignore*/
box->mTitle = title_string;
}
@ -187,18 +187,18 @@ void LLDebugVarMessageBox::onClose(bool app_quitting)
void LLDebugVarMessageBox::draw()
{
char text[128];
char text[128]; /*Flawfinder: ignore*/
switch(mVarType)
{
case VAR_TYPE_F32:
sprintf(text, "%.3f", *((F32*)mVarData));
snprintf(text, sizeof(text), "%.3f", *((F32*)mVarData)); /*Flawfinder: ignore*/
break;
case VAR_TYPE_S32:
sprintf(text, "%d", *((S32*)mVarData));
snprintf(text, sizeof(text), "%d", *((S32*)mVarData)); /*Flawfinder: ignore*/
break;
case VAR_TYPE_VEC3:
LLVector3* vec_p = (LLVector3*)mVarData;
sprintf(text, "%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]);
snprintf(text, sizeof(text), "%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]); /*Flawfinder: ignore*/
break;
}
mText->setText(text);

View File

@ -184,7 +184,7 @@ OSStatus LLDirPicker::doNavChooseDialog()
AEKeyword theAEKeyword;
DescType typeCode;
Size actualSize = 0;
char path[LL_MAX_PATH];
char path[LL_MAX_PATH]; /*Flawfinder: ignore*/
memset(&fsRef, 0, sizeof(fsRef));
error = AEGetNthPtr(&navReply.selection, 1, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);

Some files were not shown because too many files have changed in this diff Show More