diff options
63 files changed, 501 insertions, 367 deletions
| diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 9d8d91a58e..348175675e 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -570,7 +570,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)  				timer.reset();  				uuid.toString(uuid_str); -				snprintf(d_path, LL_MAX_PATH, "%s.dsf", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str()); /*Flawfinder: ignore*/ +				snprintf(d_path, LL_MAX_PATH, "%s.dsf", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str()); 	/* Flawfinder: ignore */  				mCurrentDecodep = new LLVorbisDecodeState(uuid, d_path);  				if (!mCurrentDecodep->initDecode()) diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 4e9e99aca0..3be8e121c6 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -156,7 +156,7 @@ LLBVHLoader::Status LLBVHLoader::loadTranslationTable(const char *fileName)  	//--------------------------------------------------------------------  	char path[LL_MAX_PATH];		/* Flawfinder: ignore */ -	snprintf( path, sizeof(path), "%s",/* Flawfinder: ignore */ +	snprintf( path, sizeof(path), "%s",	/* Flawfinder: ignore */  		gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName).c_str());	 diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index ea77126aca..0aeefb1a21 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1708,11 +1708,11 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const  			success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset");  			if (shared_constraintp->mConstraintTargetType == TYPE_GROUND)  			{ -				snprintf(volume_name,sizeof(volume_name), "%s", "GROUND");	/* Flawfinder: ignore */ +				snprintf(volume_name,sizeof(volume_name), "%s", "GROUND");		/* Flawfinder: ignore */  			}  			else  			{ -				snprintf(volume_name, sizeof(volume_name),"%s", /* 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"); diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 40ec4bde35..a4d61c35c5 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -329,7 +329,7 @@ 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",	/* Flawfinder: ignore */ +	snprintf( path,sizeof(path), "%s_%s.llp",  		gDirUtilp->getExpandedFilename(LL_PATH_MOTIONS,mCharacter->getAnimationPrefix()).c_str(),  		getName().c_str() );	 diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index accb4ae909..34064b758e 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -450,7 +450,7 @@ std::string LLGestureStepWait::getLabel() const  	if (mFlags & WAIT_FLAG_TIME)  	{  		char buffer[64];		/* Flawfinder: ignore */ -		snprintf(buffer, sizeof(buffer), "%.1f seconds", (double)mWaitSeconds);		/* Flawfinder: ignore */ +		snprintf(buffer, sizeof(buffer), "%.1f seconds", (double)mWaitSeconds);	/* Flawfinder: ignore */  		label += buffer;  	}  	else if (mFlags & WAIT_FLAG_ALL_ANIM) diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 8fa171c482..aaecbf3ddc 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -62,9 +62,9 @@  #endif  // Deal with the differeneces on Windows -#if defined(LL_WINDOWS) -#define snprintf _snprintf	/*Flawfinder: ignore*/ -#endif	//	LL_WINDOWS +#if LL_WINDOWS +#define snprintf safe_snprintf		/* Flawfinder: ignore */ +#endif	// LL_WINDOWS  // Static linking with apr on windows needs to be declared.  #ifdef LL_WINDOWS diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index a044710195..a941941fa8 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -598,7 +598,7 @@ bool CProcessor::AnalyzeIntelProcessor()  	else  	{  		// If there's no serial number support we just put "No serial number" -		snprintf( /* Flawfinder: ignore */ +		snprintf(	/* Flawfinder: ignore */  			CPUInfo.strProcessorSerial,  			sizeof(CPUInfo.strProcessorSerial),  			"No Processor Serial Number");	 @@ -974,7 +974,7 @@ bool CProcessor::AnalyzeAMDProcessor()  		if ((ecxreg >> 24) > 0)  		{  			CPUInfo._L1.Data.bPresent = true; -			snprintf(CPUInfo._L1.Data.strSize, sizeof(CPUInfo._L1.Data.strSize), "%d KB", ecxreg >> 24);	/*Flawfinder: ignore*/ +			snprintf(CPUInfo._L1.Data.strSize, sizeof(CPUInfo._L1.Data.strSize), "%d KB", ecxreg >> 24);		/* Flawfinder: ignore */  			CPUInfo._L1.Data.uiAssociativeWays = (ecxreg >> 15) & 0xFF;  			CPUInfo._L1.Data.uiLineSize = ecxreg & 0xFF;  		} @@ -982,7 +982,7 @@ bool CProcessor::AnalyzeAMDProcessor()  		if ((edxreg >> 24) > 0)  		{  			CPUInfo._L1.Instruction.bPresent = true; -			snprintf(CPUInfo._L1.Instruction.strSize, sizeof(CPUInfo._L1.Instruction.strSize), "%d KB", edxreg >> 24); /*Flawfinder: ignore*/ +			snprintf(CPUInfo._L1.Instruction.strSize, sizeof(CPUInfo._L1.Instruction.strSize), "%d KB", edxreg >> 24); 	/* Flawfinder: ignore */  			CPUInfo._L1.Instruction.uiAssociativeWays = (edxreg >> 15) & 0xFF;  			CPUInfo._L1.Instruction.uiLineSize = edxreg & 0xFF;  		} @@ -1006,7 +1006,7 @@ bool CProcessor::AnalyzeAMDProcessor()  		if (((ecxreg >> 12) & 0xF) > 0)  		{  			CPUInfo._L2.bPresent = true; -			snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", ecxreg >> 16);	/*Flawfinder: ignore*/ +			snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", ecxreg >> 16);		/* Flawfinder: ignore */  			switch ((ecxreg >> 12) & 0xF)  			{  				case 1: @@ -1099,9 +1099,9 @@ bool CProcessor::AnalyzeUnknownProcessor()  	strcpy(CPUInfo.strProcessorSerial, "Unknown / Not supported");	/*Flawfinder: ignore*/  	// For the family, model and brand id we can only print the numeric value -	snprintf(CPUInfo.strBrandID, sizeof(CPUInfo.strBrandID), "Brand-ID number %d", CPUInfo.uiBrandID);	/*Flawfinder: ignore*/ -	snprintf(CPUInfo.strFamily, sizeof(CPUInfo.strFamily), "Family number %d", CPUInfo.uiFamily);	/*Flawfinder: ignore*/ -	snprintf(CPUInfo.strModel, sizeof(CPUInfo.strModel), "Model number %d", CPUInfo.uiModel);	/*Flawfinder: ignore*/ +	snprintf(CPUInfo.strBrandID, sizeof(CPUInfo.strBrandID), "Brand-ID number %d", CPUInfo.uiBrandID);		/* Flawfinder: ignore */ +	snprintf(CPUInfo.strFamily, sizeof(CPUInfo.strFamily), "Family number %d", CPUInfo.uiFamily);		/* Flawfinder: ignore */ +	snprintf(CPUInfo.strModel, sizeof(CPUInfo.strModel), "Model number %d", CPUInfo.uiModel);		/* Flawfinder: ignore */  	// Nevertheless we can determine the processor type      switch (CPUInfo.uiType) @@ -1951,7 +1951,7 @@ const ProcessorInfo *CProcessor::GetCPUInfo()  	if(l1dcachesize != 0)  	{  		CPUInfo._L1.Data.bPresent = true; -		snprintf(CPUInfo._L1.Data.strSize, sizeof(CPUInfo._L1.Data.strSize), "%d KB", l1dcachesize / 1024);	/* Flawfinder: ignore */	 +		snprintf(CPUInfo._L1.Data.strSize, sizeof(CPUInfo._L1.Data.strSize), "%d KB", l1dcachesize / 1024);	/* Flawfinder: ignore */  //		CPUInfo._L1.Data.uiAssociativeWays = ???;  		CPUInfo._L1.Data.uiLineSize = cachelinesize;  	} @@ -1959,7 +1959,7 @@ const ProcessorInfo *CProcessor::GetCPUInfo()  	if(l1icachesize != 0)  	{  		CPUInfo._L1.Instruction.bPresent = true; -		snprintf(CPUInfo._L1.Instruction.strSize, sizeof(CPUInfo._L1.Instruction.strSize), "%d KB", l1icachesize / 1024);	/* Flawfinder: ignore */	 +		snprintf(CPUInfo._L1.Instruction.strSize, sizeof(CPUInfo._L1.Instruction.strSize), "%d KB", l1icachesize / 1024);	/* Flawfinder: ignore */  //		CPUInfo._L1.Instruction.uiAssociativeWays = ???;  		CPUInfo._L1.Instruction.uiLineSize = cachelinesize;  	} @@ -1967,7 +1967,7 @@ const ProcessorInfo *CProcessor::GetCPUInfo()  	if(l2cachesize != 0)  	{  		CPUInfo._L2.bPresent = true; -		snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", l2cachesize / 1024);	/* Flawfinder: ignore */	 +		snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", l2cachesize / 1024);	/* Flawfinder: ignore */  //		CPUInfo._L2.uiAssociativeWays = ???;  		CPUInfo._L2.uiLineSize = cachelinesize;  	} @@ -1975,7 +1975,7 @@ const ProcessorInfo *CProcessor::GetCPUInfo()  	if(l3cachesize != 0)  	{  		CPUInfo._L2.bPresent = true; -		snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", l3cachesize / 1024);	/* Flawfinder: ignore */	 +		snprintf(CPUInfo._L2.strSize, sizeof(CPUInfo._L2.strSize), "%d KB", l3cachesize / 1024);	/* Flawfinder: ignore */  //		CPUInfo._L2.uiAssociativeWays = ???;  		CPUInfo._L2.uiLineSize = cachelinesize;  	} diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 767a72dfe9..c6f436a5bb 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -654,6 +654,33 @@ std::string mbcsstring_makeASCII(const std::string& wstr)  	return out_str;  } +#if LL_WINDOWS +/* If the size of the passed in buffer is not large enough to hold the string, + * two bad things happen: + * 1. resulting formatted string is NOT null terminated + * 2. Depending on the platform, the return value could be a) the required + *    size of the buffer to copy the entire formatted string or b) -1. + *    On Windows with VS.Net 2003, it returns -1 e.g.  + * + * safe_snprintf always adds a NULL terminator so that the caller does not + * need to check for return value or need to add the NULL terminator. + * It does not, however change the return value - to let the caller know + * that the passed in buffer size was not large enough to hold the formatted string. + * + */ +int safe_snprintf(char *str, size_t size, const char *format, ...) +{ +	va_list args; +	va_start(args, format); + +	int num_written = _vsnprintf(str, size, format, args); /* Flawfinder: ignore */ +	va_end(args); +	 +	str[size-1] = '\0'; // always null terminate +	return num_written; +} +#endif // LL_WINDOWS +  S32	LLStringOps::collate(const llwchar* a, const llwchar* b)  {   	#if LL_WINDOWS diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6e9ea0b5a0..cbfc2a2a75 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -19,6 +19,7 @@  #include <stdlib.h>  #include <errno.h>  #include <math.h> +#include <stdarg.h> /* for vsnprintf */  #if LL_LINUX  #include <wctype.h>  #include <wchar.h> @@ -445,6 +446,9 @@ std::ostream& operator<<(std::ostream &s, const LLStringBase<T> &str)  std::ostream& operator<<(std::ostream &s, const LLWString &wstr); +#if LL_WINDOWS +int safe_snprintf(char *str, size_t size, const char *format, ...); +#endif // LL_WINDOWS  /**   * Many of the 'strip' and 'replace' methods of LLStringBase need diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ad6f85b068..54276f9f2f 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -124,7 +124,7 @@ LLOSInfo::LLOSInfo() :  			}  			else  			{ -				snprintf( /* Flawfinder: ignore */ +				snprintf(	/* Flawfinder: ignore */  					tmp,  					sizeof(tmp),  					"%s (Build %d)", @@ -324,7 +324,7 @@ std::string LLCPUInfo::getCPUStringTerse() const  	if (freq < 10000.f && freq > 200.f )  	{  		char tmp[MAX_STRING];		/* Flawfinder: ignore */ -		snprintf(tmp, sizeof(tmp), " (%.0f Mhz)", freq);		/* Flawfinder: ignore */ +		snprintf(tmp, sizeof(tmp), " (%.0f Mhz)", freq);	/* Flawfinder: ignore */  		cpu_string.append(tmp);  	} diff --git a/indra/llcommon/lluuidhashmap.h b/indra/llcommon/lluuidhashmap.h index f7d32b1fe0..98a269b1a4 100644 --- a/indra/llcommon/lluuidhashmap.h +++ b/indra/llcommon/lluuidhashmap.h @@ -206,7 +206,7 @@ inline S32 LLUUIDHashMap<DATA_TYPE, SIZE>::getLength() const  	S32 bin;  	for (bin = 0; bin < 256; bin++)  	{ -		LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[bin]; +		LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = (LLUUIDHashNode<DATA_TYPE, SIZE>*) &mNodes[bin];  		while (nodep)  		{  			count += nodep->mCount; @@ -421,6 +421,7 @@ public:  	~LLUUIDHashMapIter(); +	inline void reset();  	inline void first();  	inline void next();  	inline BOOL done() const; @@ -460,10 +461,17 @@ LLUUIDHashMapIter<DATA_TYPE, SIZE>::LLUUIDHashMapIter(LLUUIDHashMap<DATA_TYPE, S  template <class DATA_TYPE, int SIZE>  LLUUIDHashMapIter<DATA_TYPE, SIZE>::~LLUUIDHashMapIter()  { +	reset(); +} + +template <class DATA_TYPE, int SIZE> +inline void LLUUIDHashMapIter<DATA_TYPE, SIZE>::reset() +{  	if (mCurHashNodep)  	{  		// We're partway through an iteration, we can clean up now  		mHashMapp->mIterCount--; +		mCurHashNodep = NULL;  	}  } diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index c392d23d22..94a90f2c20 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1082,7 +1082,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu  	if(inv_type_str)   		output_stream << "\t\tinv_type\t" << inv_type_str << "\n";  	char buffer[32];	/* Flawfinder: ignore */ -	snprintf(buffer, sizeof(buffer), "\t\tflags\t%08x\n", mFlags);	/* 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"; diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index e55163f30d..7daab177a4 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -738,15 +738,15 @@ BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const  	output_stream <<  "\t{\n";  	char buffer[256];	/* Flawfinder: ignore */ -	snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n",		mMaskBase);	/* Flawfinder: ignore */ +	snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n",		mMaskBase);		/* Flawfinder: ignore */  	output_stream << buffer; -	snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n",		mMaskOwner);	/* Flawfinder: ignore */ +	snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n",		mMaskOwner);		/* Flawfinder: ignore */  	output_stream << buffer; -	snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n",		mMaskGroup);	/* Flawfinder: ignore */ +	snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n",		mMaskGroup);		/* Flawfinder: ignore */  	output_stream << buffer; -	snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n",	mMaskEveryone);	/* Flawfinder: ignore */ +	snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n",	mMaskEveryone);		/* Flawfinder: ignore */  	output_stream << buffer; -	snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n",	mMaskNextOwner);	/* Flawfinder: ignore */ +	snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n",	mMaskNextOwner);		/* Flawfinder: ignore */  	output_stream << buffer;  	mCreator.toString(uuid_str); diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 0e41d110fc..19a4add25b 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -278,7 +278,7 @@ F32 LLVolumeLODGroup::dump()  	}  	usage = usage / (F32)NUM_LODS; -	snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]);		/* Flawfinder: ignore */ +	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; diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index d1bb575c36..873e8fa9db 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -1253,7 +1253,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss  		char uuid_str[UUID_STR_LENGTH];	/* Flawfinder: ignore */   		uuid.toString(uuid_str); -		snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type));	/* Flawfinder: ignore */  +		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 */   		if (fp) diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 10929dfbb2..9670c641c2 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -538,7 +538,7 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog()  	S32 cur_line = 0;  	for (i = 0; i < mBufferSize; i++)  	{ -		snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer) - cur_line_pos*3, "%02x ", mBufferp[i]); /*Flawfinder: ignore*/ +		snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer) - cur_line_pos*3, "%02x ", mBufferp[i]); 	/* Flawfinder: ignore */  		cur_line_pos++;  		if (cur_line_pos >= 16)  		{ @@ -563,7 +563,7 @@ BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)   	{ -		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value);		/*Flawfinder: ignore*/ +		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value);		/* Flawfinder: ignore */  	}  	else  	{ @@ -572,14 +572,15 @@ BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name)  	// snprintf returns number of bytes that would have been written  	// had the output not being truncated. In that case, it will -	// return >= passed in size value.  so a check needs to be added +	// return either -1 or value >= passed in size value . So a check needs to be added  	// to detect truncation, and if there is any, only account for the  	// actual number of bytes written..and not what could have been  	// written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		// *NOTE: I believe we need to mark a failure bit at this point.  	    numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packString: string truncated: " << value << llendl;  	}  	mCurBufferp += numCopied;  	return success; @@ -607,7 +608,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch  	int numCopied = 0;  	if (mWriteEnabled)  	{ -		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%010d ", size);		/*Flawfinder: ignore*/ +		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%010d ", size);	/* Flawfinder: ignore */  		// snprintf returns number of bytes that would have been  		// written had the output not being truncated. In that case, @@ -615,9 +616,10 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch  		// to be added to detect truncation, and if there is any, only  		// account for the actual number of bytes written..and not  		// what could have been written. -		if (numCopied > getBufferSize()-getCurrentSize()) +		if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  		{  			numCopied = getBufferSize()-getCurrentSize(); +			llwarns << "LLDataPackerAsciiBuffer::packBinaryData: number truncated: " << size << llendl;  		}  		mCurBufferp += numCopied; @@ -626,10 +628,11 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch  		BOOL bBufferFull = FALSE;  		for (i = 0; i < size && !bBufferFull; i++)  		{ -			numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]);		/* Flawfinder: ignore */ -			if (numCopied > getBufferSize()-getCurrentSize()) +			numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]);	/* Flawfinder: ignore */ +			if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  			{  				numCopied = getBufferSize()-getCurrentSize(); +				llwarns << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << llendl;  				bBufferFull = TRUE;  			}  			mCurBufferp += numCopied; @@ -637,10 +640,11 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch  		if (!bBufferFull)  		{ -			numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(), "\n");		/* Flawfinder: ignore */ -			if (numCopied > getBufferSize()-getCurrentSize()) +			numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(), "\n");	/* Flawfinder: ignore */ +			if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  		    	{  				numCopied = getBufferSize()-getCurrentSize(); +				llwarns << "LLDataPackerAsciiBuffer::packBinaryData: newline truncated: " << llendl;  		    	}  		    	mCurBufferp += numCopied;  		} @@ -698,10 +702,11 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con  		BOOL bBufferFull = FALSE;  		for (i = 0; i < size && !bBufferFull; i++)  		{ -			numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]);		/* Flawfinder: ignore */ -			if (numCopied > getBufferSize()-getCurrentSize()) +			numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]);	/* Flawfinder: ignore */ +			if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  			{  			    numCopied = getBufferSize()-getCurrentSize(); +				llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << llendl;  			    bBufferFull = TRUE;  			}  			mCurBufferp += numCopied; @@ -709,10 +714,11 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con  		}  		if (!bBufferFull)  		{ -			numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(), "\n");		/* Flawfinder: ignore */ -			if (numCopied > getBufferSize()-getCurrentSize()) +			numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(), "\n");	/* Flawfinder: ignore */ +			if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  			{  				numCopied = getBufferSize()-getCurrentSize(); +				llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: newline truncated: " << llendl;  			}  			mCurBufferp += numCopied; @@ -762,21 +768,24 @@ BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);		/*Flawfinder: ignore*/ +	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);	/* Flawfinder: ignore */  	}  	else  	{  		// just do the write to a temp buffer to get the length -		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value);		/* Flawfinder: ignore */ +		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packU8: val truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -807,20 +816,23 @@ BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);		/*Flawfinder: ignore*/ +	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);	/* Flawfinder: ignore */  	}  	else  	{ -		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value);		/* Flawfinder: ignore */ +		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packU16: val truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -852,19 +864,22 @@ BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%u\n", value);		/* Flawfinder: ignore */ +	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%u\n", value);	/* Flawfinder: ignore */  	}  	else  	{ -		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%u\n", value);		/* Flawfinder: ignore */ +		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%u\n", value);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packU32: val truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -893,19 +908,22 @@ BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);		/* Flawfinder: ignore */ +	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d\n", value);	/* Flawfinder: ignore */  	}  	else  	{  		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%d\n", value);		/* Flawfinder: ignore */	  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packS32: val truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -934,19 +952,22 @@ BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name)  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%g\n", value);		/* Flawfinder: ignore */ +	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%g\n", value);	/* Flawfinder: ignore */  	}  	else  	{ -		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%g\n", value);		/* Flawfinder: ignore */	 +		numCopied = snprintf(DUMMY_BUFFER, sizeof(DUMMY_BUFFER), "%g\n", value);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packF32: val truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -975,19 +996,22 @@ BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%g %g %g %g\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */ +	    numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%g %g %g %g\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */  	}  	else  	{  		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%g %g %g %g\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packColor4: truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -1015,19 +1039,22 @@ BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *na  	int numCopied = 0;  	if (mWriteEnabled)  	{ -	    	numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d %d %d %d\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */ +		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%d %d %d %d\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */  	}  	else  	{  		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%d %d %d %d\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packColor4U: truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -1066,15 +1093,18 @@ BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *na  	}  	else  	{ -		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%g %g\n", value.mV[0], value.mV[1]);		/* Flawfinder: ignore */ +		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%g %g\n", value.mV[0], value.mV[1]);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  		numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packVector2: truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -1109,13 +1139,16 @@ BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *na  	{  		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%g %g %g\n", value.mV[0], value.mV[1], value.mV[2]);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  	    numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packVector3: truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -1149,13 +1182,16 @@ BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *na  	{  		numCopied = snprintf(DUMMY_BUFFER,sizeof(DUMMY_BUFFER),"%g %g %g %g\n", value.mV[0], value.mV[1], value.mV[2], value.mV[3]);	/* Flawfinder: ignore */  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  	    numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packVector4: truncated: " << llendl;  	}  	mCurBufferp += numCopied; @@ -1193,13 +1229,16 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name)  	{  		numCopied = 64 + 1; // UUID + newline  	} -	// snprintf returns number of bytes that would have been written had the  -	// output not being truncated. In that case, it will retuen >= passed in size value. -	// so a check needs to be added to detect truncation, and if there is any, -	// only account for the actual number of bytes written..and not what could have been written. -	if (numCopied > getBufferSize()-getCurrentSize()) +	// snprintf returns number of bytes that would have been written +	// had the output not being truncated. In that case, it will +	// return either -1 or value >= passed in size value . So a check needs to be added +	// to detect truncation, and if there is any, only account for the +	// actual number of bytes written..and not what could have been +	// written. +	if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  	{  	    numCopied = getBufferSize()-getCurrentSize(); +		llwarns << "LLDataPackerAsciiBuffer::packUUID: truncated: " << llendl;  		success = FALSE;  	}  	mCurBufferp += numCopied; @@ -1235,21 +1274,26 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name)  		int numCopied = 0;  		if (mWriteEnabled)  		{ -	    		numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\t", name);	/* Flawfinder: ignore */ +			numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\t", name);	/* Flawfinder: ignore */  		}  		else  		{  			numCopied = (S32)strlen(name) + 1; 	/* Flawfinder: ignore */ //name + tab  	  		} -		// snprintf returns number of bytes that would have been written had the  -		// output not being truncated. In that case, it will retuen >= passed in size value. -		// so a check needs to be added to detect truncation, and if there is any, -		// only account for the actual number of bytes written..and not what could have been written. -		if (numCopied > getBufferSize()-getCurrentSize()) +		// snprintf returns number of bytes that would have been written +		// had the output not being truncated. In that case, it will +		// return either -1 or value >= passed in size value . So a check needs to be added +		// to detect truncation, and if there is any, only account for the +		// actual number of bytes written..and not what could have been +		// written. +		if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())  		{  			numCopied = getBufferSize()-getCurrentSize(); +			llwarns << "LLDataPackerAsciiBuffer::writeIndentedName: truncated: " << llendl;  		} + +		mCurBufferp += numCopied;  	}  } @@ -1405,7 +1449,7 @@ BOOL LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const  		S32 i;  		for (i = 0; i < size; i++)  		{ -			snprintf(buffer, sizeof(buffer), "%02x ", value[i]); /*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "%02x ", value[i]);	/* Flawfinder: ignore */  			*mOutputStream << buffer;  		}  		*mOutputStream << "\n"; diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 66203321ef..d395188b72 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -51,7 +51,7 @@ void LLHost::getString(char* buffer, S32 length) const  		return;  	} -	snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort);  /*Flawfinder: ignore*/ +	snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort); 	/* Flawfinder: ignore */  }  void LLHost::getIPString(char* buffer, S32 length) const @@ -62,7 +62,7 @@ void LLHost::getIPString(char* buffer, S32 length) const  		return;  	} -	snprintf(buffer, length, "%s", u32_to_ip_string(mIP)); /*Flawfinder: ignore*/ +	snprintf(buffer, length, "%s", u32_to_ip_string(mIP));	/* Flawfinder: ignore */  } diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index e786cf64b3..a4eebed504 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -672,7 +672,7 @@ void LLHTTPAssetStorage::checkForTimeouts()  		char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/  		req->getUUID().toString(uuid_str);  		std::string base_url = getBaseURL(req->getUUID(), req->getType()); -		snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType())); /*Flawfinder: ignore*/ +		snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType()));	/* Flawfinder: ignore */  		LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),   										req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle); @@ -707,7 +707,7 @@ void LLHTTPAssetStorage::checkForTimeouts()  		char tmp_url[MAX_STRING];/*Flawfinder: ignore*/  		char uuid_str[UUID_STR_LENGTH];/*Flawfinder: ignore*/  		req->getUUID().toString(uuid_str); -		snprintf(tmp_url, sizeof(tmp_url), 					/*Flawfinder: ignore*/ +		snprintf(tmp_url, sizeof(tmp_url), 					/* Flawfinder: ignore */  				do_compress ? "%s/%s.%s.gz" : "%s/%s.%s",  				mBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType()));  @@ -762,7 +762,7 @@ void LLHTTPAssetStorage::checkForTimeouts()  		req->getUUID().toString(uuid_str);  		// KLW - All temporary uploads are saved locally "http://localhost:12041/asset" -		snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); /*Flawfinder: ignore*/ +		snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); 	/* Flawfinder: ignore */  		LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),   										req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle); diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index ecdc9e6dc3..944785c3a5 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -207,8 +207,21 @@ void pack_instant_message_block(  	S32 bytes_left = MTUBYTES;  	if(message)  	{ -		char buffer[MTUBYTES];	/*Flawfinder: ignore*/ -		bytes_left -= snprintf(buffer, MTUBYTES, "%s", message);	/*Flawfinder: ignore*/ +		char buffer[MTUBYTES]; +		int num_written = snprintf(buffer, MTUBYTES, "%s", message);	/* Flawfinder: ignore */ +		// snprintf returns number of bytes that would have been written +		// had the output not being truncated. In that case, it will +		// return either -1 or value >= passed in size value . So a check needs to be added +		// to detect truncation, and if there is any, only account for the +		// actual number of bytes written..and not what could have been +		// written. +		if (num_written < 0 || num_written >= MTUBYTES) +		{ +			num_written = MTUBYTES - 1; +			llwarns << "pack_instant_message_block: message truncated: " << message << llendl; +		} + +		bytes_left -= num_written;  		bytes_left = llmax(0, bytes_left);  		msg->addStringFast(_PREHASH_Message, buffer);  	} diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 46d31685e3..14c266950d 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -114,7 +114,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id,  	mRemoteHost = remote_host;  	mDeleteRemoteOnCompletion = delete_remote_on_completion; -	snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str());		/* Flawfinder : ignore */ +	snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str());	/* Flawfinder: ignore */  	mCallback = callback;  	mCallbackDataHandle = user_data; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index ec2f0cd20a..099b6a0a5b 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -1950,7 +1950,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )  						std::ostringstream str;  						str << "MSG: <- " << host;  						char buffer[MAX_STRING]; /* Flawfinder: ignore*/ -						snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mReceiveSize, (mIncomingCompressedSize ? mIncomingCompressedSize : mReceiveSize), mCurrentRecvPacketID);/* Flawfinder: ignore*/ +						snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mReceiveSize, (mIncomingCompressedSize ? mIncomingCompressedSize : mReceiveSize), mCurrentRecvPacketID);	/* Flawfinder: ignore */  						str << buffer << "(unknown)"  							<< (recv_reliable ? " reliable" : "")  							<< " resent " @@ -3224,7 +3224,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re  		std::ostringstream str;  		str << "MSG: <- " << host;  		char buffer[MAX_STRING];			/* Flawfinder: ignore */ -		snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mReceiveSize, (mIncomingCompressedSize ? mIncomingCompressedSize: mReceiveSize), mCurrentRecvPacketID);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mReceiveSize, (mIncomingCompressedSize ? mIncomingCompressedSize: mReceiveSize), mCurrentRecvPacketID);	/* Flawfinder: ignore */  		str << buffer  			<< mCurrentRMessageTemplate->mName  			<< (recv_reliable ? " reliable" : "") @@ -4771,75 +4771,75 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)  	char tmp_str[MAX_STRING];	 /* Flawfinder: ignore */   	F32 run_time = mMessageSystemTimer.getElapsedTimeF32();  	str << "START MESSAGE LOG SUMMARY" << std::endl; -	snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time);	/* Flawfinder: ignore */  	// Incoming  	str << buffer << std::endl << "Incoming:" << std::endl;  	U64_to_str(mTotalBytesIn, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total bytes received:      %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total bytes received:      %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time);	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mPacketsIn, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total packets received:    %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total packets received:    %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time));	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Average packet size:       %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Average packet size:       %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn);	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mReliablePacketsIn, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total reliable packets:    %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total reliable packets:    %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1));		/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mCompressedPacketsIn, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total compressed packets:  %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total compressed packets:  %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1));	/* Flawfinder: ignore */  	str << buffer << std::endl;  	S64 savings = mUncompressedBytesIn - mCompressedBytesIn;  	U64_to_str(savings, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str);	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(savings/(mCompressedPacketsIn +1), tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Avg comp packet savings:   %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Avg comp packet savings:   %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1));	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(savings/(mPacketsIn+1), tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Avg overall comp savings:  %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Avg overall comp savings:  %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f));	/* Flawfinder: ignore */  	// Outgoing  	str << buffer << std::endl << std::endl << "Outgoing:" << std::endl;  	U64_to_str(mTotalBytesOut, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total bytes sent:          %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time );	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total bytes sent:          %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time );	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mPacketsOut, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total packets sent:        %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total packets sent:        %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time));	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Average packet size:       %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Average packet size:       %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut);	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mReliablePacketsOut, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total reliable packets:    %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1));		/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total reliable packets:    %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1));		/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(mCompressedPacketsOut, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total compressed packets:  %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total compressed packets:  %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1));		/* Flawfinder: ignore */  	str << buffer << std::endl;  	savings = mUncompressedBytesOut - mCompressedBytesOut;  	U64_to_str(savings, tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str);	/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(savings/(mCompressedPacketsOut +1), tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Avg comp packet savings:   %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Avg comp packet savings:   %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1));		/* Flawfinder: ignore */  	str << buffer << std::endl;  	U64_to_str(savings/(mPacketsOut+1), tmp_str, sizeof(tmp_str)); -	snprintf(buffer, MAX_STRING, "Avg overall comp savings:  %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f));	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Avg overall comp savings:  %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f));		/* Flawfinder: ignore */  	str << buffer << std::endl << std::endl; -	snprintf(buffer, MAX_STRING, "SendPacket failures:       %20d", mSendPacketFailureCount);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "SendPacket failures:       %20d", mSendPacketFailureCount);	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Dropped packets:           %20d", mDroppedPackets);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Dropped packets:           %20d", mDroppedPackets);	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Resent packets:            %20d", mResentPackets);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Resent packets:            %20d", mResentPackets);	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Failed reliable resends:   %20d", mFailedResendPackets);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Failed reliable resends:   %20d", mFailedResendPackets);	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets);	/* Flawfinder: ignore */  	str << buffer << std::endl; -	snprintf(buffer, MAX_STRING, "On-circuit invalid packets:   %17d", mInvalidOnCircuitPackets);	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "On-circuit invalid packets:   %17d", mInvalidOnCircuitPackets);		/* Flawfinder: ignore */  	str << buffer << std::endl << std::endl;  	str << "Decoding: " << std::endl; -	snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg");	/* Flawfinder: ignore */  +	snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg");	/* Flawfinder: ignore */  	str << buffer << std:: endl;	  	F32 avg;  	for (message_template_name_map_t::iterator iter = mMessageTemplates.begin(), @@ -4850,7 +4850,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)  		if(mt->mTotalDecoded > 0)  		{  			avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; -			snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg);	/* Flawfinder: ignore */  +			snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg);	/* Flawfinder: ignore */  			str << buffer << std::endl;  		}  	} @@ -5565,7 +5565,7 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs(  	d.update((const unsigned char *) colon, (U32)strlen(colon));	/* Flawfinder: ignore */  -	snprintf(tbuf, sizeof(tbuf),"%i", number);	/* Flawfinder: ignore */  +	snprintf(tbuf, sizeof(tbuf),"%i", number);		/* Flawfinder: ignore */  	d.update((unsigned char *) tbuf, (U32)strlen(tbuf));	/* Flawfinder: ignore */   	d.update((const unsigned char *) colon, (U32)strlen(colon));	/* Flawfinder: ignore */  @@ -5824,7 +5824,7 @@ void LLMessageSystem::dumpPacketToLog()  	S32 cur_line = 0;  	for (i = 0; i < mTrueReceiveSize; i++)  	{ -		snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer),"%02x ", mTrueReceiveBuffer[i]);	/* Flawfinder: ignore */  +		snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer),"%02x ", mTrueReceiveBuffer[i]);	/* Flawfinder: ignore */  		cur_line_pos++;  		if (cur_line_pos >= 16)  		{ diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 058c3b5d65..366ecc7d6f 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -714,7 +714,7 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)  			snprintf(pcode_string, sizeof(pcode_string), "text bubble");	/* Flawfinder: ignore */  			break;  		case LL_PCODE_LEGACY_TREE: -			snprintf(pcode_string, sizeof(pcode_string), "tree");	/* Flawfinder: ignore */ +			snprintf(pcode_string, sizeof(pcode_string), "tree");		/* Flawfinder: ignore */  			break;  		case LL_PCODE_TREE_NEW:  			snprintf(pcode_string, sizeof(pcode_string), "tree_new");	/* Flawfinder: ignore */ @@ -745,23 +745,23 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)  		}  		else if (base_code == LL_PCODE_PYRAMID)  		{ -			snprintf(shape, sizeof(shape), "pyramid");	/* Flawfinder: ignore */ +			snprintf(shape, sizeof(shape), "pyramid");		/* Flawfinder: ignore */  		}  		else if (base_code == LL_PCODE_SPHERE)  		{ -			snprintf(shape, sizeof(shape), "sphere");	/* Flawfinder: ignore */ +			snprintf(shape, sizeof(shape), "sphere");		/* Flawfinder: ignore */  		}  		else if (base_code == LL_PCODE_TETRAHEDRON)  		{ -			snprintf(shape, sizeof(shape), "tetrahedron");	/* Flawfinder: ignore */ +			snprintf(shape, sizeof(shape), "tetrahedron");		/* Flawfinder: ignore */  		}  		else if (base_code == LL_PCODE_VOLUME)  		{ -			snprintf(shape, sizeof(shape), "volume");	/* Flawfinder: ignore */ +			snprintf(shape, sizeof(shape), "volume");		/* Flawfinder: ignore */  		}  		else if (base_code == LL_PCODE_APP)  		{ -			snprintf(shape, sizeof(shape), "app");	/* Flawfinder: ignore */ +			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)  		{ -			snprintf(mask, sizeof(mask), "%x", mask_code);	/* Flawfinder: ignore */ +			snprintf(mask, sizeof(mask), "%x", mask_code);		/* Flawfinder: ignore */  		}  		else if (mask_code & LL_PCODE_HEMI_MASK)  		{ -			snprintf(mask, sizeof(mask), "hemi");	/* Flawfinder: ignore */ +			snprintf(mask, sizeof(mask), "hemi");		/* Flawfinder: ignore */  		}  		else if (mask != 0)  		{ -			snprintf(mask, sizeof(mask), "%x", mask_code);	/* Flawfinder: ignore */ +			snprintf(mask, sizeof(mask), "%x", mask_code);		/* Flawfinder: ignore */  		}  		else  		{ @@ -788,11 +788,11 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)  		if (mask[0])  		{ -			snprintf(pcode_string, sizeof(pcode_string), "%s-%s", shape, mask);	/* Flawfinder: ignore */ +			snprintf(pcode_string, sizeof(pcode_string), "%s-%s", shape, mask);		/* Flawfinder: ignore */  		}  		else  		{ -			snprintf(pcode_string, sizeof(pcode_string), "%s", shape);	/* Flawfinder: ignore */ +			snprintf(pcode_string, sizeof(pcode_string), "%s", shape);		/* Flawfinder: ignore */  		}  	}  	return pcode_string; diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp index d19ca2c309..b265bdd4ac 100644 --- a/indra/llrender/llgldbg.cpp +++ b/indra/llrender/llgldbg.cpp @@ -81,7 +81,7 @@ char *fv3(F32 *f)  char *fv1(F32 *f)  {  	static char str[128];	/* Flawfinder: ignore */ -	snprintf(str, sizeof(str), "%8.3f", f[0]);	/* Flawfinder: ignore */ +	snprintf(str, sizeof(str), "%8.3f", f[0]);		/* Flawfinder: ignore */  	return str;  } diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index bfa663d64b..bc8c173492 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -71,7 +71,7 @@ LLDir_Linux::LLDir_Linux()  	// *NOTE: /proc/%d/exe doesn't work on FreeBSD. But that's ok,  	// because this is the linux implementation. -	snprintf (path, sizeof(path), "/proc/%d/exe", (int) getpid ()); /* Flawfinder: ignore */ +	snprintf (path, sizeof(path), "/proc/%d/exe", (int) getpid ());   	int rc = readlink (path, tmp_str, sizeof (tmp_str)-1);	/* Flawfinder: ignore */   	if ( (rc != -1) && (rc <= ((int) sizeof (tmp_str)-1)) )  	{ diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index c18e72b706..bc02ebfb63 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -72,7 +72,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)  	if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))  	{  		char buffer[1024];/* Flawfinder: ignore */ -		snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */ +		snprintf(buffer, sizeof(buffer),   			"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" @@ -407,7 +407,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits  			mFullscreenRefresh = -1;  			char error[256];	/* Flawfinder: ignore */ -			snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);	/* Flawfinder: ignore */ +			snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);	  			OSMessageBox(error, "Error", OSMB_OK);  		}  	} diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 865aba3cec..ba007abb5c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -186,7 +186,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)  	if (!strncasecmp(RENDERER, bad_card, strlen(bad_card)))  	{  		char buffer[1024];	/* Flawfinder: ignore */ -		snprintf(buffer, sizeof(buffer),	/* Flawfinder: ignore */ +		snprintf(buffer, sizeof(buffer),	  			"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" @@ -295,7 +295,7 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)  	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",	/* Flawfinder: ignore */ +	snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s",	  		 gDirUtilp->getAppRODataDir().c_str(),  		 gDirUtilp->getDirDelimiter().c_str(),  		 gDirUtilp->getDirDelimiter().c_str(), @@ -466,7 +466,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B  			mFullscreenRefresh = -1;  			char error[256];	/* Flawfinder: ignore */ -			snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);	/* Flawfinder: ignore */ +			snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);	  			OSMessageBox(error, "Error", OSMB_OK);  		}  	} @@ -1165,7 +1165,7 @@ x11clipboard_type convert_format(int type)  		these right now, and support is skeletal. */  		char format[sizeof(FORMAT_PREFIX)+8+1];	/* Flawfinder: ignore */ -		snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type);	/* Flawfinder: ignore */ +		snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type);  		return XInternAtom(gWindowImplementation->mSDL_Display,  				   format, False);  	} diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 131fb7bb3c..0415be8206 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -2143,7 +2143,7 @@ void LLXMLNode::setFloatValue(U32 length, const F32 *array, Encoding encoding, U  			{  				precision = 25;  			} -			snprintf(format_string, sizeof(format_string), "%%.%dg", precision);		/* Flawfinder: ignore */ +			snprintf(format_string, sizeof(format_string), "%%.%dg", precision);	/* Flawfinder: ignore */  		}  		else  		{ @@ -2194,7 +2194,7 @@ void LLXMLNode::setDoubleValue(U32 length, const F64 *array, Encoding encoding,  			{  				precision = 25;  			} -			snprintf(format_string, sizeof(format_string), "%%.%dg", precision);		/* Flawfinder: ignore */ +			snprintf(format_string, sizeof(format_string), "%%.%dg", precision);	/* Flawfinder: ignore */  		}  		else  		{ diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index c3d791179a..e54b1c400d 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -57,7 +57,7 @@ BOOL LLXmlParser::parseFile(const std::string &path)  	FILE* file = LLFile::fopen(path.c_str(), "rb");		/* Flawfinder: ignore */  	if( !file )  	{ -		snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Couldn't open file %s", path.c_str());		/* Flawfinder: ignore */ +		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 )   		{ -			snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Unable to allocate XML buffer while reading file %s", path.c_str() );		/* Flawfinder: ignore */ +			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 )  		{ -			snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while reading file  %s", path.c_str() );		/* Flawfinder: ignore */ +			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 ) )  		{ -			snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while parsing file  %s", path.c_str() );		/* Flawfinder: ignore */ +			snprintf( mAuxErrorString, sizeof(mAuxErrorString), "Error while parsing file  %s", path.c_str() );	/* Flawfinder: ignore */  			success = FALSE;  		} diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp index 0b02c3ebb4..8b6ec2ad0c 100644 --- a/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/indra/lscript/lscript_compile/lscript_tree.cpp @@ -7967,7 +7967,7 @@ void LLScriptIf::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pas  	case LSCP_EMIT_BYTE_CODE:  		{  			char jumpname[32];	 	/*Flawfinder: ignore*/ -			snprintf(jumpname, sizeof(jumpname),"##Temp Jump %d##", gTempJumpCount++); 	/*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]); @@ -8048,9 +8048,9 @@ void LLScriptIfElse::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass  	case LSCP_EMIT_BYTE_CODE:  		{  			char jumpname1[32]; 				/*Flawfinder: ignore*/ -			snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); 	/*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*/ +			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]); @@ -8151,9 +8151,9 @@ void LLScriptFor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pa  	case LSCP_EMIT_BYTE_CODE:  		{  			char jumpname1[32];		 	/*Flawfinder: ignore*/ -			snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); 	/*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*/ +			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); @@ -8248,7 +8248,7 @@ void LLScriptDoWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas  	case LSCP_EMIT_BYTE_CODE:  		{  			char jumpname1[32];	 	/*Flawfinder: ignore*/ -			snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++);	 	/*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); @@ -8322,9 +8322,9 @@ void LLScriptWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass  	case LSCP_EMIT_BYTE_CODE:  		{  			char jumpname1[32]; 	/*Flawfinder: ignore*/ -			snprintf(jumpname1, sizeof(jumpname1), "##Temp Jump %d##", gTempJumpCount++); 	/*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*/ +			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); diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index e56bfd337c..4521c7b43c 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -2996,7 +2996,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)  			case LST_STRING:  				{  					S32 address, source = lscript_pop_int(buffer); -					snprintf(caststr, sizeof(caststr), "%d", source);		/*Flawfinder: ignore*/ +					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);  				} @@ -3033,7 +3033,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)  				{  					S32 address;  					F32 source = lscript_pop_float(buffer); -					snprintf(caststr, sizeof(caststr), "%f", source);		/*Flawfinder: ignore*/ +					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);  				} @@ -3242,7 +3242,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)  					S32 address;  					LLVector3 source;  					lscript_pop_vector(buffer, source); -					snprintf(caststr, sizeof(caststr), "<%5.5f, %5.5f, %5.5f>", source.mV[VX], source.mV[VY], source.mV[VZ]);		/*Flawfinder: ignore*/ +					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);  				} @@ -3275,7 +3275,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)  					S32 address;  					LLQuaternion source;  					lscript_pop_quaternion(buffer, source); -					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*/ +					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);  				} diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index 5e87928ae6..520f0d6266 100644 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -496,7 +496,7 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)  	     s << mInteger;  	     break;  	case LST_FLOATINGPOINT: -	     snprintf(tmp, 1024, "%f", mFP);	/*Flawfinder: ignore*/ +	     snprintf(tmp, 1024, "%f", mFP);	/* Flawfinder: ignore */  	     s << tmp;  	     break;  	case LST_KEY: diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 6a799ba45f..52902ea819 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -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);		/* Flawfinder: ignore */ +	snprintf(gUpdateURL, sizeof(gUpdateURL), "http://secondlife.com/update-macos.php?userserver=%s", gUserServer);		  	// Real UI...  	OSStatus err; @@ -371,7 +371,7 @@ int main(int argc, char **argv)  	err = CreateNibReference(CFSTR("AutoUpdater"), &nib);  	char windowTitle[MAX_PATH];		/* Flawfinder: ignore */ -	snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName);		/* Flawfinder: ignore */ +	snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName);		  	CFStringRef windowTitleRef = NULL;  	windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8); @@ -545,8 +545,8 @@ int restoreObject(const char* aside, const char* target, const char* path, const  {  	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 */ +	snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object);		 +	snprintf(dest, sizeof(dest), "%s/%s", target, path);		  	FSRef sourceRef;  	FSRef destRef;  	OSStatus err; @@ -580,11 +580,11 @@ void filterFile(const char* filename)  {  	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);		/* Flawfinder: ignore */ +	snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename);		  	system(temp);		/* Flawfinder: ignore */  	// Now run it through sed. -	snprintf(temp, sizeof(temp), 		/* Flawfinder: ignore */ +	snprintf(temp, sizeof(temp), 		  			"sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename);  	system(temp);		/* Flawfinder: ignore */  } @@ -740,7 +740,7 @@ void *updatethreadproc(void*)  					throw 0;  				} -				snprintf(target, sizeof(target), "/Applications/%s.app", gProductName);		/* Flawfinder: ignore */ +				snprintf(target, sizeof(target), "/Applications/%s.app", gProductName);		  				memset(&targetRef, 0, sizeof(targetRef));  				err = FSPathMakeRef((UInt8*)target, &targetRef, NULL); @@ -836,7 +836,7 @@ void *updatethreadproc(void*)  		chdir(tempDir); -		snprintf(temp, sizeof(temp), "SecondLife.dmg");		/* Flawfinder: ignore */ +		snprintf(temp, sizeof(temp), "SecondLife.dmg");		  		downloadFile = fopen(temp, "wb");		/* Flawfinder: ignore */  		if(downloadFile == NULL) @@ -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);		/* Flawfinder: ignore */ +		snprintf(temp, sizeof(temp), "%s/mnt/Second Life.app", tempDir);		  		llinfos << "Source application is: " << temp << llendl; @@ -967,7 +967,7 @@ void *updatethreadproc(void*)  		{  			// Construct the name of the target based on the product name  			char appName[MAX_PATH];		/* Flawfinder: ignore */ -			snprintf(appName, sizeof(appName), "%s.app", gProductName);		/* Flawfinder: ignore */ +			snprintf(appName, sizeof(appName), "%s.app", gProductName);		  			utf8str_to_HFSUniStr255( &appNameUniStr, appName );  		} @@ -1016,7 +1016,7 @@ void *updatethreadproc(void*)  			llinfos << "Clearing cache..." << llendl;  			char mask[LL_MAX_PATH];		/* Flawfinder: ignore */ -			snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str());		/* Flawfinder: ignore */ +			snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str());		  			gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask);  			llinfos << "Clear complete." << llendl; @@ -1048,7 +1048,7 @@ void *updatethreadproc(void*)  	{  		llinfos << "Detaching disk image." << llendl; -		snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode);		/* Flawfinder: ignore */ +		snprintf(temp, sizeof(temp), "hdiutil detach '%s'", deviceNode);		  		system(temp);		/* Flawfinder: ignore */  	} @@ -1073,12 +1073,12 @@ void *updatethreadproc(void*)  	{  		llinfos << "Touching application bundle." << llendl; -		snprintf(temp, sizeof(temp), "touch '%s'", target);		/* Flawfinder: ignore */ +		snprintf(temp, sizeof(temp), "touch '%s'", target);		  		system(temp);		/* Flawfinder: ignore */  		llinfos << "Launching updated application." << llendl; -		snprintf(temp, sizeof(temp), "open '%s'", target);		/* Flawfinder: ignore */ +		snprintf(temp, sizeof(temp), "open '%s'", target);		  		system(temp);		/* Flawfinder: ignore */  	} diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index ac337e12cc..d31c7b4f53 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -179,7 +179,7 @@ BOOL LLFloaterScriptQueue::start()  {  	//llinfos << "LLFloaterCompileQueue::start()" << llendl;  	char buffer[MAX_STRING]; 				/*Flawfinder: ignore*/ -	snprintf(buffer, sizeof(buffer), "Starting %s of %d items.", mStartString, mObjectIDs.count()); 	/*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); @@ -219,7 +219,7 @@ BOOL LLFloaterScriptQueue::nextObject()  		mDone = TRUE;  		char buffer[MAX_STRING];		/*Flawfinder: ignore*/ -		snprintf(buffer, sizeof(buffer), "Done.");			/*Flawfinder: ignore*/ +		snprintf(buffer, sizeof(buffer), "Done.");				/* Flawfinder: ignore */  		list->addSimpleItem(buffer);  		childSetEnabled("close",TRUE);  	} @@ -364,7 +364,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,  		LLVFile file(vfs, asset_id, type);  		char uuid_str[UUID_STR_LENGTH];		/*Flawfinder: ignore*/  		asset_id.toString(uuid_str); -		snprintf(filename, sizeof(filename), "%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /*Flawfinder: ignore*/ +		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*/  		if (fp) @@ -384,7 +384,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,  		}  		// It's now in the file, now compile it. -		snprintf(buffer, sizeof(buffer), "Downloaded, now compiling '%s'.", data->mScriptName.c_str());  /*Flawfinder: ignore*/ +		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); -			snprintf(buffer, sizeof(buffer), "Problem downloading %s.", /*Flawfinder: ignore*/ +			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); -			snprintf(buffer, sizeof(buffer), "Insufficient permissions for '%s'.", /*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "Insufficient permissions for '%s'.", 	/* Flawfinder: ignore */  				data->mScriptName.c_str());  		}  		else  		{ -			snprintf(buffer, sizeof(buffer), "Unknown failure to download %s.", /*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "Unknown failure to download %s.", 	/* Flawfinder: ignore */  				data->mScriptName.c_str());  		} @@ -477,9 +477,9 @@ void LLFloaterCompileQueue::compile(const char* filename,  	char uuid_string[UUID_STR_LENGTH];  /*Flawfinder: ignore*/  	new_asset_id.toString(uuid_string);  	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*/ +	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*/ +	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, @@ -603,7 +603,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,  				LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));  				LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");  				char buffer[MAX_STRING];		 /*Flawfinder: ignore*/ -				snprintf(buffer, sizeof(buffer), "Resetting '%s'.", item->getName().c_str());		 /*Flawfinder: ignore*/ +				snprintf(buffer, sizeof(buffer), "Resetting '%s'.", item->getName().c_str());		 	/* Flawfinder: ignore */  				list->addSimpleItem(buffer);  				LLMessageSystem* msg = gMessageSystem;  				msg->newMessageFast(_PREHASH_ScriptReset); @@ -666,7 +666,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,  				LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));  				LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");  				char buffer[MAX_STRING];  	/*Flawfinder: ignore*/ -				snprintf(buffer, sizeof(buffer), "Running '%s'.", item->getName().c_str());		 /*Flawfinder: ignore*/ +				snprintf(buffer, sizeof(buffer), "Running '%s'.", item->getName().c_str());		 	/* Flawfinder: ignore */  				list->addSimpleItem(buffer);  				LLMessageSystem* msg = gMessageSystem; @@ -731,7 +731,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,  				LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));  				LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");  				char buffer[MAX_STRING];		 /*Flawfinder: ignore*/ -				snprintf(buffer, sizeof(buffer), "Not running '%s'.", item->getName().c_str());	 /*Flawfinder: ignore*/ +				snprintf(buffer, sizeof(buffer), "Not running '%s'.", item->getName().c_str());	 	/* Flawfinder: ignore */  				list->addSimpleItem(buffer);  				LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index d230cbc190..0ce745a373 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -191,14 +191,14 @@ void LLDebugVarMessageBox::draw()  	switch(mVarType)  	{  	case VAR_TYPE_F32: -		snprintf(text, sizeof(text), "%.3f", *((F32*)mVarData));		 /*Flawfinder: ignore*/ +		snprintf(text, sizeof(text), "%.3f", *((F32*)mVarData));		 	/* Flawfinder: ignore */  		break;  	case VAR_TYPE_S32: -		snprintf(text, sizeof(text), "%d", *((S32*)mVarData)); 		 /*Flawfinder: ignore*/ +		snprintf(text, sizeof(text), "%d", *((S32*)mVarData)); 		 	/* Flawfinder: ignore */  		break;  	case VAR_TYPE_VEC3:  		LLVector3* vec_p = (LLVector3*)mVarData; -		snprintf(text, sizeof(text), "%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]);	 /*Flawfinder: ignore*/ +		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); diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index e37850c997..3c296615f6 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -262,7 +262,7 @@ BOOL LLFloaterAnimPreview::postBuild()  			childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration()));  			mEnabled = TRUE;  			char seconds_string[128];		/*Flawfinder: ignore*/ -			snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration());		/*Flawfinder: ignore*/ +			snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration());	/* Flawfinder: ignore */  			setTitle(mFilename + LLString(seconds_string));  		} @@ -284,7 +284,7 @@ BOOL LLFloaterAnimPreview::postBuild()  			{  				char output_str[256];	/*Flawfinder: ignore*/ -				snprintf(output_str, sizeof(output_str), "Animation file is %.1f seconds in length.\n\nMaximum animation length is %.1f seconds.\n",			/*Flawfinder: ignore*/ +				snprintf(output_str, sizeof(output_str), "Animation file is %.1f seconds in length.\n\nMaximum animation length is %.1f seconds.\n",	/* Flawfinder: ignore */  					loaderp->getDuration(), MAX_ANIM_DURATION);  				childSetValue("bad_animation_text", LLSD(output_str));  			} diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 3492f4fff8..77ebe88a09 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -570,7 +570,7 @@ void LLPanelLandGeneral::refresh()  			else if(parcel->getAuctionID())  			{  				char auction_str[MAX_STRING];		/*Flawfinder: ignore*/ -				snprintf(auction_str, sizeof(auction_str), "Auction ID: %u", parcel->getAuctionID());	/*Flawfinder: ignore*/ +				snprintf(auction_str, sizeof(auction_str), "Auction ID: %u", parcel->getAuctionID());		/* Flawfinder: ignore */  				mTextSalePending->setText(auction_str);  				mTextSalePending->setEnabled(TRUE);  			} @@ -710,13 +710,13 @@ void LLPanelLandGeneral::refresh()  								   &dwell);  		// Area -		snprintf(price, sizeof(price), "%d sq. m.", area);		/*Flawfinder: ignore*/ +		snprintf(price, sizeof(price), "%d sq. m.", area);			/* Flawfinder: ignore */  		label = AREA;  		mTextPriceLabel->setText(label);  		mTextPrice->setText(price); -		snprintf(price, sizeof(price), "%.0f", dwell); 		/*Flawfinder: ignore*/ +		snprintf(price, sizeof(price), "%.0f", dwell); 			/* Flawfinder: ignore */  		mTextDwell->setText(price);  		if(region_owner) @@ -761,7 +761,7 @@ void LLPanelLandGeneral::refreshNames()  		char owner_first[MAX_STRING];	/*Flawfinder: ignore*/  		char owner_last[MAX_STRING];	/*Flawfinder: ignore*/  		gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last); -		snprintf(buffer, sizeof(buffer), "%s %s", owner_first, owner_last); 	/*Flawfinder: ignore*/ +		snprintf(buffer, sizeof(buffer), "%s %s", owner_first, owner_last); 		/* Flawfinder: ignore */  	}  	if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) @@ -922,8 +922,8 @@ void LLPanelLandGeneral::onClickBuyPass(void* data)  	F32 pass_hours = parcel->getPassHours();  	char cost[256], time[256];		/*Flawfinder: ignore*/ -	snprintf(cost, sizeof(cost), "%d", pass_price);	/*Flawfinder: ignore*/ -	snprintf(time, sizeof(time), "%.2f", pass_hours);		/*Flawfinder: ignore*/ +	snprintf(cost, sizeof(cost), "%d", pass_price);		/* Flawfinder: ignore */ +	snprintf(time, sizeof(time), "%.2f", pass_hours);			/* Flawfinder: ignore */  	LLStringBase<char>::format_map_t args;  	args["[COST]"] = cost; @@ -1247,7 +1247,7 @@ void LLPanelLandObjects::refresh()  		if (parcel_object_bonus != 1.0f)  		{ -			snprintf(count, sizeof(count), "Region Object Bonus Factor: %.2f", 		/*Flawfinder: ignore*/ +			snprintf(count, sizeof(count), "Region Object Bonus Factor: %.2f", 			/* Flawfinder: ignore */  					parcel_object_bonus);  			mParcelObjectBonus->setText(count);  		} @@ -1258,35 +1258,35 @@ void LLPanelLandObjects::refresh()  		if (sw_total > sw_max)  		{ -			snprintf(count, sizeof(count), "%d out of %d (%d will be deleted)", 		/*Flawfinder: ignore*/ +			snprintf(count, sizeof(count), "%d out of %d (%d will be deleted)", 			/* Flawfinder: ignore */  					sw_total, sw_max, sw_total - sw_max);  		}  		else  		{ -			snprintf(count, sizeof(count), "%d out of %d (%d available)",  			/*Flawfinder: ignore*/ +			snprintf(count, sizeof(count), "%d out of %d (%d available)",  				/* Flawfinder: ignore */  					sw_total, sw_max, sw_max - sw_total);  		}  		mSWTotalObjects->setText(count); -		snprintf(count, sizeof(count),  "%d", max);		/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count),  "%d", max);	/* Flawfinder: ignore */  		mObjectContribution->setText(count); -		snprintf(count, sizeof(count), "%d", total);		/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", total);			/* Flawfinder: ignore */  		mTotalObjects->setText(count); -		snprintf(count, sizeof(count), "%d", owned);	/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", owned);		/* Flawfinder: ignore */  		mOwnerObjects->setText(count); -		snprintf(count, sizeof(count), "%d", group);		/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", group);			/* Flawfinder: ignore */  		mGroupObjects->setText(count); -		snprintf(count, sizeof(count), "%d", other);		/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", other);			/* Flawfinder: ignore */  		mOtherObjects->setText(count); -		snprintf(count, sizeof(count), "%d", selected);	/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", selected);		/* Flawfinder: ignore */  		mSelectedObjects->setText(count); -		snprintf(count, sizeof(count), "%d", mOtherTime);			/*Flawfinder: ignore*/ +		snprintf(count, sizeof(count), "%d", mOtherTime);	/* Flawfinder: ignore */  		mCleanOtherObjectsTime->setText(count);  		BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED); @@ -1617,7 +1617,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo  		// Placeholder for name.  		row->addColumn("", FONT, self->mColWidth[2]); -		snprintf(object_count_str, sizeof(object_count_str), "%d", object_count); 	/*Flawfinder: ignore*/ +		snprintf(object_count_str, sizeof(object_count_str), "%d", object_count); 		/* Flawfinder: ignore */  		row->addColumn(object_count_str, FONT, self->mColWidth[3]);  		if (is_group_owned) @@ -2175,7 +2175,7 @@ void LLPanelLandOptions::refresh()  		else  		{  			char buffer[256];	/*Flawfinder: ignore*/ -			snprintf(buffer, sizeof(buffer), "Landing Point: %d, %d, %d",	/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "Landing Point: %d, %d, %d",		/* Flawfinder: ignore */  					llround(pos.mV[VX]),  					llround(pos.mV[VY]),  					llround(pos.mV[VZ])); @@ -2559,14 +2559,14 @@ void LLPanelLandAccess::refresh()  		char group_name[MAX_STRING];	/*Flawfinder: ignore*/  		gCacheName->getGroupName(parcel->getGroupID(), group_name); -		snprintf(label, sizeof(label), "Group: %s", group_name);	/*Flawfinder: ignore*/ +		snprintf(label, sizeof(label), "Group: %s", group_name);		/* Flawfinder: ignore */  		mCheckGroup->setLabel( label );  		S32 count = parcel->mAccessList.size();  		BOOL use_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST);  		mCheckAccess->set( use_list ); -		snprintf(label, sizeof(label), "Avatars: (%d listed, %d max)",	/*Flawfinder: ignore*/ +		snprintf(label, sizeof(label), "Avatars: (%d listed, %d max)",		/* Flawfinder: ignore */  				count, PARCEL_MAX_ACCESS_LIST);  		mCheckAccess->setLabel( label ); @@ -2586,7 +2586,7 @@ void LLPanelLandAccess::refresh()  				if (seconds >= 120)  				{  					char buf[30];	/*Flawfinder: ignore*/ -					snprintf(buf, sizeof(buf), "%d minutes", (seconds/60));	/*Flawfinder: ignore*/ +					snprintf(buf, sizeof(buf), "%d minutes", (seconds/60));		/* Flawfinder: ignore */  					suffix.append(buf);  				}  				else if (seconds >= 60) @@ -2596,7 +2596,7 @@ void LLPanelLandAccess::refresh()  				else  				{  					char buf[30];		/*Flawfinder: ignore*/ -					snprintf(buf, sizeof(buf), "%d seconds", seconds);	/*Flawfinder: ignore*/ +					snprintf(buf, sizeof(buf), "%d seconds", seconds);		/* Flawfinder: ignore */  					suffix.append(buf);  				}  				suffix.append(" remaining)"); @@ -2661,7 +2661,7 @@ void LLPanelLandAccess::refreshNames()  		gCacheName->getGroupName(parcel->getGroupID(), group_name);  	}  	char label[MAX_STRING];		/*Flawfinder: ignore*/ -	snprintf(label, sizeof(label), "Group: %s", group_name);	/*Flawfinder: ignore*/ +	snprintf(label, sizeof(label), "Group: %s", group_name);		/* Flawfinder: ignore */  	mCheckGroup->setLabel(label);  } @@ -2836,7 +2836,7 @@ void LLPanelLandBan::refresh()  		BOOL use_ban = parcel->getParcelFlag(PF_USE_BAN_LIST);  		mCheck->set( use_ban ); -		snprintf(label, sizeof(label), "Ban these avatars: (%d listed, %d max)",	/*Flawfinder: ignore*/ +		snprintf(label, sizeof(label), "Ban these avatars: (%d listed, %d max)",		/* Flawfinder: ignore */  				count, PARCEL_MAX_ACCESS_LIST);  		mCheck->setLabel( label ); @@ -2855,7 +2855,7 @@ void LLPanelLandBan::refresh()  				if (seconds >= 120)  				{  					char buf[30];		/*Flawfinder: ignore*/ -					snprintf(buf, sizeof(buf), "%d minutes", (seconds/60));	/*Flawfinder: ignore*/ +					snprintf(buf, sizeof(buf), "%d minutes", (seconds/60));		/* Flawfinder: ignore */  					suffix.append(buf);  				}  				else if (seconds >= 60) @@ -2865,7 +2865,7 @@ void LLPanelLandBan::refresh()  				else  				{  					char buf[30];	/*Flawfinder: ignore*/ -					snprintf(buf, sizeof(buf), "%d seconds", seconds);	/*Flawfinder: ignore*/ +					snprintf(buf, sizeof(buf), "%d seconds", seconds);		/* Flawfinder: ignore */  					suffix.append(buf);  				}  				suffix.append(" remaining)"); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index c722773f93..919e218a68 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -188,20 +188,20 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**)  		S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;  		char location[MAX_STRING];		/* Flawfinder: ignore */ -		snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y);		/* Flawfinder: ignore */ +		snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y);			/* Flawfinder: ignore */  		char area[MAX_STRING];		/* Flawfinder: ignore */  		if(billable_area == actual_area)  		{ -			snprintf(area, MAX_STRING, "%d", billable_area);		/* Flawfinder: ignore */ +			snprintf(area, MAX_STRING, "%d", billable_area);			/* Flawfinder: ignore */  		}  		else  		{ -			snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area);		/* Flawfinder: ignore */ +			snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area);			/* Flawfinder: ignore */  		}  		char hidden[MAX_STRING];		/* Flawfinder: ignore */ -		snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y);		/* Flawfinder: ignore */ +		snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y);			/* Flawfinder: ignore */  		LLSD element;  		element["columns"][0]["column"] = "name"; @@ -294,12 +294,12 @@ void LLFloaterLandHoldings::refreshAggregates()  	char buffer[MAX_STRING];		/* Flawfinder: ignore */ -	snprintf(buffer, MAX_STRING, "%d sq. meters", allowed_area);		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%d sq. meters", allowed_area);			/* Flawfinder: ignore */  	childSetValue("allowed_text", LLSD(buffer)); -	snprintf(buffer, MAX_STRING, "%d sq. meters", current_area);		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%d sq. meters", current_area);			/* Flawfinder: ignore */  	childSetValue("current_text", LLSD(buffer)); -	snprintf(buffer, MAX_STRING, "%d sq. meters", available_area);		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%d sq. meters", available_area);			/* Flawfinder: ignore */  	childSetValue("available_text", LLSD(buffer));  } diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index feeedc5190..baa549e5c1 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -415,27 +415,27 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)  		char perm_string[11];		/* Flawfinder: ignore */ -		snprintf(perm_string, sizeof(perm_string), "B: ");		/* Flawfinder: ignore */ +		snprintf(perm_string, sizeof(perm_string), "B: ");			/* Flawfinder: ignore */  		mask_to_string(base_mask, perm_string+3);  		childSetText("BaseMaskDebug",perm_string);  		childSetVisible("BaseMaskDebug",TRUE); -		snprintf(perm_string, sizeof(perm_string), "O: ");		/* Flawfinder: ignore */ +		snprintf(perm_string, sizeof(perm_string), "O: ");			/* Flawfinder: ignore */  		mask_to_string(owner_mask, perm_string+3);  		childSetText("OwnerMaskDebug",perm_string);  		childSetVisible("OwnerMaskDebug",TRUE); -		snprintf(perm_string, sizeof(perm_string), "G%s: ", overwrite_group ? "*" : "");		/* Flawfinder: ignore */ +		snprintf(perm_string, sizeof(perm_string), "G%s: ", overwrite_group ? "*" : "");			/* Flawfinder: ignore */  		mask_to_string(group_mask, perm_string + (overwrite_group ? 4 : 3));  		childSetText("GroupMaskDebug",perm_string);  		childSetVisible("GroupMaskDebug",TRUE); -		snprintf(perm_string, sizeof(perm_string), "E%s: ", overwrite_everyone ? "*" : "");		/* Flawfinder: ignore */ +		snprintf(perm_string, sizeof(perm_string), "E%s: ", overwrite_everyone ? "*" : "");			/* Flawfinder: ignore */  		mask_to_string(everyone_mask, perm_string + (overwrite_everyone ? 4 : 3));  		childSetText("EveryoneMaskDebug",perm_string);  		childSetVisible("EveryoneMaskDebug",TRUE); -		snprintf(perm_string, sizeof(perm_string), "N%s: ", slam_perm ? "*" : "");		/* Flawfinder: ignore */ +		snprintf(perm_string, sizeof(perm_string), "N%s: ", slam_perm ? "*" : "");			/* Flawfinder: ignore */  		mask_to_string(next_owner_mask, perm_string + (slam_perm ? 4 : 3));  		childSetText("NextMaskDebug",perm_string);  		childSetVisible("NextMaskDebug",TRUE); @@ -549,7 +549,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)  	{  		radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1);  		char numerical_price[MAX_STRING];		/* Flawfinder: ignore */ -		snprintf(numerical_price, MAX_STRING, "%d", sale_info.getSalePrice());		/* Flawfinder: ignore */ +		snprintf(numerical_price, MAX_STRING, "%d", sale_info.getSalePrice());			/* Flawfinder: ignore */  		childSetText("EditPrice",numerical_price);  	}  	else diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 2857339db3..4cc00b12d1 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -678,34 +678,34 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()  	strings_t strings;  	//integers_t integers;  	char buffer[MAX_STRING];		/* Flawfinder: ignore*/ -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer)); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer)); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer)); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer));  	F32 value = (F32)childGetValue("agent_limit_spin").asReal(); -	snprintf(buffer, MAX_STRING, "%f", value);		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%f", value);			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer));  	value = (F32)childGetValue("object_bonus_spin").asReal(); -	snprintf(buffer, MAX_STRING, "%f", value);		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%f", value);			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer));  	U8 access = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString().c_str()); -	snprintf(buffer, MAX_STRING, "%d", (S32)access);		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%d", (S32)access);			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer)); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer)); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(strings_t::value_type(buffer));  	LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -774,13 +774,13 @@ BOOL LLPanelRegionDebugInfo::sendUpdate()  	strings_t strings;  	char buffer[MAX_STRING];		/* Flawfinder: ignore */ -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(buffer);  	LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -938,7 +938,7 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region)  	char buffer[MAX_STRING];		/* Flawfinder: ignore */  	for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)  	{ -		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);			/* Flawfinder: ignore */  		texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer);  		if(texture_ctrl)  		{ @@ -951,9 +951,9 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region)  	for(S32 i = 0; i < CORNER_COUNT; ++i)      { -		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);			/* Flawfinder: ignore */  		childSetValue(buffer, LLSD(compp->getStartHeight(i))); -		snprintf(buffer, MAX_STRING, "height_range_spin_%d", i);	/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "height_range_spin_%d", i);		/* Flawfinder: ignore */  		childSetValue(buffer, LLSD(compp->getHeightRange(i)));  	} @@ -968,15 +968,15 @@ BOOL LLPanelRegionTextureInfo::postBuild()  	char buffer[MAX_STRING];		/* Flawfinder: ignore */  	for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)  	{ -		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);			/* Flawfinder: ignore */  		initCtrl(buffer);  	}  	for(S32 i = 0; i < CORNER_COUNT; ++i)  	{ -		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);			/* Flawfinder: ignore */  		initCtrl(buffer); -		snprintf(buffer, MAX_STRING, "height_range_spin_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "height_range_spin_%d", i);			/* Flawfinder: ignore */  		initCtrl(buffer);  	} @@ -1016,13 +1016,13 @@ BOOL LLPanelRegionTextureInfo::sendUpdate()  	for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)  	{ -		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);			/* Flawfinder: ignore */  		texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer);  		if(texture_ctrl)  		{  			LLUUID tmp_id(texture_ctrl->getImageAssetID());  			tmp_id.toString(id_str); -			snprintf(buffer, MAX_STRING, "%d %s", i, id_str);		/* Flawfinder: ignore */		 +			snprintf(buffer, MAX_STRING, "%d %s", i, id_str);			/* Flawfinder: ignore */  			strings.push_back(strings_t::value_type(buffer));  		}  	} @@ -1030,9 +1030,9 @@ BOOL LLPanelRegionTextureInfo::sendUpdate()  	strings.clear();  	for(S32 i = 0; i < CORNER_COUNT; ++i)  	{ -		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);		/* Flawfinder: ignore */ -		snprintf(buffer2, MAX_STRING, "height_range_spin_%d", i);		/* Flawfinder: ignore */ -		snprintf(buffer, MAX_STRING, "%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal());		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "height_start_spin_%d", i);			/* Flawfinder: ignore */ +		snprintf(buffer2, MAX_STRING, "height_range_spin_%d", i);			/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal());			/* Flawfinder: ignore */  		strings.push_back(strings_t::value_type(buffer));  	}  	sendEstateOwnerMessage(msg, "textureheights", invoice, strings); @@ -1046,7 +1046,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes()  	for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)  	{  		char buffer[MAX_STRING];		/* Flawfinder: ignore */ -		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);		/* Flawfinder: ignore */ +		snprintf(buffer, MAX_STRING, "texture_detail_%d", i);			/* Flawfinder: ignore */  		LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer);  		if (!texture_ctrl) continue; @@ -1151,17 +1151,17 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()  	strings_t strings;  	LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); -	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("water_height_spin").asReal());		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("water_height_spin").asReal());			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_raise_spin").asReal());		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_raise_spin").asReal());			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_lower_spin").asReal());		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_lower_spin").asReal());			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore*/		 +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N"));		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N"));			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("sun_hour_slider").asReal() );		/* Flawfinder: ignore*/	 +	snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("sun_hour_slider").asReal() );			/* Flawfinder: ignore */  	strings.push_back(buffer);  	// Grab estate information in case the user decided to set the @@ -1187,11 +1187,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()  		estate_sun_hour = panel->getSunHour();  	} -	snprintf(buffer, MAX_STRING, "%s", (estate_global_time ? "Y" : "N") );		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%s", (estate_global_time ? "Y" : "N") );			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%s", (estate_fixed_sun ? "Y" : "N") );		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%s", (estate_fixed_sun ? "Y" : "N") );			/* Flawfinder: ignore */  	strings.push_back(buffer); -	snprintf(buffer, MAX_STRING, "%f", estate_sun_hour);		/* Flawfinder: ignore*/ +	snprintf(buffer, MAX_STRING, "%f", estate_sun_hour);			/* Flawfinder: ignore */  	strings.push_back(buffer);  	sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); @@ -1808,7 +1808,7 @@ void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_  	msg->nextBlock("ParamList");  	msg->addString("Parameter", buf); -	snprintf(buf, MAX_STRING, "%u", flags);		/* Flawfinder: ignore*/ +	snprintf(buf, MAX_STRING, "%u", flags);			/* Flawfinder: ignore */  	msg->nextBlock("ParamList");  	msg->addString("Parameter", buf); @@ -2065,7 +2065,7 @@ void LLPanelEstateInfo::commitEstateInfo()  	msg->addString("Parameter", getEstateName());  	char buf[MAX_STRING];		/* Flawfinder: ignore*/ -	snprintf(buf, MAX_STRING, "%u", computeEstateFlags());		/* Flawfinder: ignore*/ +	snprintf(buf, MAX_STRING, "%u", computeEstateFlags());			/* Flawfinder: ignore */  	msg->nextBlock("ParamList");  	msg->addString("Parameter", buf); @@ -2075,7 +2075,7 @@ void LLPanelEstateInfo::commitEstateInfo()  		sun_hour = 0.f;	// 0 = global time  	} -	snprintf(buf, MAX_STRING, "%d", (S32)(sun_hour*1024.0f));		/* Flawfinder: ignore*/ +	snprintf(buf, MAX_STRING, "%d", (S32)(sun_hour*1024.0f));	/* Flawfinder: ignore */  	msg->nextBlock("ParamList");  	msg->addString("Parameter", buf); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 62f5fd21d5..9a486d76ee 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -707,7 +707,7 @@ LLSD LLFloaterReporter::gatherReport()  	details << childGetValue("details_edit").asString();  	char version_string[MAX_STRING];		/* Flawfinder: ignore */ -	snprintf(version_string,						/* Flawfinder: ignore */ +	snprintf(version_string,				/* Flawfinder: ignore */  			MAX_STRING,  			"%d.%d.%d %s %s %s %s",  			LL_VERSION_MAJOR, diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 1c75b7e220..f1f062c5af 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -225,7 +225,7 @@ void LLFloaterTelehub::onClickRemoveSpawnPoint(void* data)  	msg->addString("Parameter", "spawnpoint remove");  	char buffer[MAX_STRING];		/* Flawfinder: ignore */ -	snprintf(buffer, MAX_STRING, "%d", spawn_index);		/* Flawfinder: ignore */ +	snprintf(buffer, MAX_STRING, "%d", spawn_index);	/* Flawfinder: ignore */  	msg->nextBlock("ParamList");  	msg->addString("Parameter", buffer); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4de746fd4f..c3ec9e8f2b 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -818,7 +818,7 @@ LLString LLItemBridge::getLabelSuffix() const  			if(xfer) sxfer = EMPTY;  			else sxfer = NO_XFER;  			char buffer[MAX_STRING];		/*Flawfinder: ignore*/ -			snprintf(					/*Flawfinder: ignore*/ +			snprintf(						/* Flawfinder: ignore */  				buffer,  				MAX_STRING,  				"%s%s%s", diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 2a686c46b9..b834845107 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1136,7 +1136,7 @@ void LLInventoryModel::cache(  	char inventory_filename[LL_MAX_PATH];		/*Flawfinder: ignore*/  	agent_id.toString(agent_id_str);  	std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, agent_id_str)); -	snprintf(		/*Flawfinder: ignore*/ +	snprintf(			/* Flawfinder: ignore */  		inventory_filename,  		LL_MAX_PATH,  		CACHE_FORMAT_STRING, @@ -1425,7 +1425,7 @@ bool LLInventoryModel::loadSkeleton(  		owner_id.toString(owner_id_str);  		std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));  		char inventory_filename[LL_MAX_PATH];		/*Flawfinder: ignore*/ -		snprintf(		/*Flawfinder: ignore*/ +		snprintf(			/* Flawfinder: ignore */  			inventory_filename,  			LL_MAX_PATH,  			CACHE_FORMAT_STRING, diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index f47bbbd2b2..a9ddcd9f1c 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -435,25 +435,25 @@ void LLManip::renderXYZ(const LLVector3 &vec)  		LLGLDepthTest gls_depth(GL_FALSE);  		LLGLEnable tex(GL_TEXTURE_2D);  		// render drop shadowed text -		snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); -		snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); -		snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);  		// render text on top -		snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);  		glColor3f(0.5f, 1.f, 0.5f); -		snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);  		glColor3f(0.5f, 0.5f, 1.f); -		snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]);		/*Flawfinder: ignore*/ +		snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]);			/* Flawfinder: ignore */  		hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);  	}  } @@ -502,22 +502,22 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi  	{  		if (fractional_portion == 0)  		{ -			snprintf(val_string, sizeof(val_string), "-%d%s", lltrunc(llabs(val_to_print)), suffix);		/*Flawfinder: ignore*/ +			snprintf(val_string, sizeof(val_string), "-%d%s", lltrunc(llabs(val_to_print)), suffix);			/* Flawfinder: ignore */  		}  		else  		{ -			snprintf(val_string, sizeof(val_string), "-%d", lltrunc(llabs(val_to_print)));		/*Flawfinder: ignore*/ +			snprintf(val_string, sizeof(val_string), "-%d", lltrunc(llabs(val_to_print)));			/* Flawfinder: ignore */  		}  	}  	else  	{  		if (fractional_portion == 0)  		{ -			snprintf(val_string, sizeof(val_string), "%d%s", lltrunc(llabs(val_to_print)), suffix);		/*Flawfinder: ignore*/ +			snprintf(val_string, sizeof(val_string), "%d%s", lltrunc(llabs(val_to_print)), suffix);			/* Flawfinder: ignore */  		}  		else  		{ -			snprintf(val_string, sizeof(val_string), "%d", lltrunc(val_to_print));		/*Flawfinder: ignore*/ +			snprintf(val_string, sizeof(val_string), "%d", lltrunc(val_to_print));			/* Flawfinder: ignore */  		}  	} @@ -540,7 +540,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi  	LLGLEnable tex(GL_TEXTURE_2D);  	if (fractional_portion != 0)  	{ -		snprintf(fraction_string, sizeof(fraction_string), "%c%d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix);		/*Flawfinder: ignore*/ +		snprintf(fraction_string, sizeof(fraction_string), "%c%d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix);			/* Flawfinder: ignore */  		gViewerWindow->setupViewport(1, -1);  		hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 874f315cc7..6aca7abc11 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -443,7 +443,7 @@ void LLMuteList::requestFromServer(const LLUUID& agent_id)  	char agent_id_string[UUID_STR_LENGTH];		/*Flawfinder: ignore*/  	char filename[LL_MAX_PATH];		/*Flawfinder: ignore*/  	agent_id.toString(agent_id_string); -	snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());		/*Flawfinder: ignore*/ +	snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());			/* Flawfinder: ignore */  	LLCRC crc;  	crc.update(filename); @@ -469,7 +469,7 @@ void LLMuteList::cache(const LLUUID& agent_id)  		char agent_id_string[UUID_STR_LENGTH];		/*Flawfinder: ignore*/  		char filename[LL_MAX_PATH];		/*Flawfinder: ignore*/  		agent_id.toString(agent_id_string); -		snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());		/*Flawfinder: ignore*/ +		snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());			/* Flawfinder: ignore */  		saveToFile(filename);  	}  } @@ -512,7 +512,7 @@ void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**)  	char agent_id_string[UUID_STR_LENGTH];		/*Flawfinder: ignore*/  	gAgent.getID().toString(agent_id_string);  	char filename[LL_MAX_PATH];		/*Flawfinder: ignore*/ -	snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());		/*Flawfinder: ignore*/ +	snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str());			/* Flawfinder: ignore */  	gMuteListp->loadFromFile(filename);  } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 3ec14b6117..ce9f6b18b2 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -2148,7 +2148,7 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**)  			item = new LLScrollListItem();  			item->addColumn( name, font, TEXT_WIDTH ); -			snprintf( value_string, sizeof(value_string),  "+%d", positive);		/*Flawfinder: ignore*/ +			snprintf( value_string, sizeof(value_string),  "+%d", positive);			/* Flawfinder: ignore */  			item->addColumn( value_string, font, 50 );  			item->addColumn("", font);	// extra column to force striped appearance diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 9adc737aab..f1aed81df1 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -458,7 +458,7 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **      S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;  	S32 region_z = llround((F32)pos_global.mdV[VZ]); -    snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z);		/*Flawfinder: ignore*/ +    snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z);			/* Flawfinder: ignore */      location_text.append(buffer);  	U8 flags; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 10db68d448..56c97d0689 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -627,7 +627,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)  		if ( visible )  		{ -			snprintf(fee_buff, sizeof(fee_buff), "Join (L$%d)", gdatap->mMembershipFee);		/*Flawfinder: ignore*/ +			snprintf(fee_buff, sizeof(fee_buff), "Join (L$%d)", gdatap->mMembershipFee);			/* Flawfinder: ignore */  			mBtnJoinGroup->setLabelSelected(std::string(fee_buff));  			mBtnJoinGroup->setLabelUnselected(std::string(fee_buff));  		} diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index f44afc136e..5a6716d965 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -223,7 +223,7 @@ void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max)  	char buffer[MAX_STRING];		/*Flawfinder: ignore*/  	buffer[0] = '\0'; -	snprintf(buffer, sizeof(buffer), "(%d max)", max);		/*Flawfinder: ignore*/ +	snprintf(buffer, sizeof(buffer), "(%d max)", max);			/* Flawfinder: ignore */  	if ( mYourContributionMaxTextp )  	{  		mYourContributionMaxTextp->setText(buffer); @@ -289,14 +289,14 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  			S32 total_contribution;  			msg->getS32("QueryData", "ActualArea", total_contribution, 0);  			char buffer[MAX_STRING];		/*Flawfinder: ignore*/ -			snprintf(buffer, sizeof(buffer), "%d sq. meters", total_contribution);		/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "%d sq. meters", total_contribution);			/* Flawfinder: ignore */  			mTotalContributedLandp->setText(buffer);  			S32 committed;  			msg->getS32("QueryData", "BillableArea", committed, 0); -			snprintf(buffer, sizeof(buffer), "%d sq. meters", committed);		/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "%d sq. meters", committed);			/* Flawfinder: ignore */  			mTotalLandInUsep->setText(buffer);  			S32 available = total_contribution - committed; -			snprintf(buffer, sizeof(buffer), "%d sq. meters", available);		/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), "%d sq. meters", available);			/* Flawfinder: ignore */  			mLandAvailablep->setText(buffer);  			buffer[0] = '\0';  			if ( mGroupOverLimitTextp && mGroupOverLimitIconp ) @@ -340,18 +340,18 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  			S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;  			S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;  			char location[MAX_STRING];		/*Flawfinder: ignore*/ -			snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y);		/*Flawfinder: ignore*/ +			snprintf(location, MAX_STRING, "%s (%d, %d)", sim_name, region_x, region_y);			/* Flawfinder: ignore */  			char area[MAX_STRING];		/*Flawfinder: ignore*/  			if(billable_area == actual_area)  			{ -				snprintf(area, MAX_STRING, "%d", billable_area);		/*Flawfinder: ignore*/ +				snprintf(area, MAX_STRING, "%d", billable_area);			/* Flawfinder: ignore */  			}  			else  			{ -				snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area);		/*Flawfinder: ignore*/ +				snprintf(area, MAX_STRING, "%d / %d", billable_area, actual_area);			/* Flawfinder: ignore */  			}  			char hidden[MAX_STRING];		/*Flawfinder: ignore*/ -			snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y);		/*Flawfinder: ignore*/ +			snprintf(hidden, MAX_STRING, "%f %f", global_x, global_y);			/* Flawfinder: ignore */  			LLSD row; @@ -977,7 +977,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,  		return;  	} -	snprintf(line, MAX_STRING,  "%s\n\n", start_date);		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING,  "%s\n\n", start_date);			/* Flawfinder: ignore */  	text.append(line);  	S32 total_amount = 0; @@ -992,7 +992,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,  		if (amount != 0)  		{ -			snprintf(line, MAX_STRING, "%-24s %6d\n", desc, amount );		/*Flawfinder: ignore*/ +			snprintf(line, MAX_STRING, "%-24s %6d\n", desc, amount );			/* Flawfinder: ignore */  			text.append(line);  		}  		else @@ -1005,7 +1005,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,  	text.append(1, '\n'); -	snprintf(line, MAX_STRING, "%-24s %6d\n", "Total", total_amount );		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING, "%-24s %6d\n", "Total", total_amount );			/* Flawfinder: ignore */  	text.append(line);  	if ( mImplementationp->mTextEditorp ) @@ -1122,7 +1122,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,  	{  		text.clear(); -		snprintf(line, MAX_STRING, "%s\n\n", start_date); 		/*Flawfinder: ignore*/ +		snprintf(line, MAX_STRING, "%s\n\n", start_date); 			/* Flawfinder: ignore */  		text.append(line);  	} @@ -1177,7 +1177,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,  					break;  				} -				snprintf(line, sizeof(line), "%s %6d - %s %s %s\n", time, amount, user, verb, item);		/*Flawfinder: ignore*/ +				snprintf(line, sizeof(line), "%s %6d - %s %s %s\n", time, amount, user, verb, item);			/* Flawfinder: ignore */  				text.append(line);  			}  		} @@ -1330,26 +1330,26 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,  		return;  	} -	snprintf(line, MAX_STRING, "Summary for this week, beginning on %s\n", start_date);		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING, "Summary for this week, beginning on %s\n", start_date);			/* Flawfinder: ignore */  	text.append(line);  	if (current_interval == 0)  	{ -		snprintf(line, MAX_STRING, "The next stipend day is %s\n\n", next_stipend_date);		/*Flawfinder: ignore*/ +		snprintf(line, MAX_STRING, "The next stipend day is %s\n\n", next_stipend_date);			/* Flawfinder: ignore */  		text.append(line); -		snprintf(line, MAX_STRING, "%-24sL$%6d\n", "Balance", balance );		/*Flawfinder: ignore*/ +		snprintf(line, MAX_STRING, "%-24sL$%6d\n", "Balance", balance );			/* Flawfinder: ignore */  		text.append(line);  		text.append(1, '\n');  	} -	snprintf(line, MAX_STRING,  "                      Group       Individual Share\n");		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING,  "                      Group       Individual Share\n");			/* Flawfinder: ignore */  	text.append(line); -	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members));		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members));			/* Flawfinder: ignore */  	text.append(line); -	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Debits", total_debits,  (S32)floor((F32)total_debits/(F32)non_exempt_members));		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Debits", total_debits,  (S32)floor((F32)total_debits/(F32)non_exempt_members));			/* Flawfinder: ignore */  	text.append(line); -	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Total", total_credits + total_debits,  (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members));		/*Flawfinder: ignore*/ +	snprintf(line, MAX_STRING,     "%-24s %6d      %6d \n", "Total", total_credits + total_debits,  (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members));			/* Flawfinder: ignore */  	text.append(line);  	if ( mImplementationp->mTextEditorp ) diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 977f89ffdc..e1ab8bf371 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -479,7 +479,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)  		row["columns"][3]["column"] = "date";  		row["columns"][3]["value"] = buffer; -		snprintf(buffer, 30, "%u", timestamp);		/*Flawfinder: ignore*/ +		snprintf(buffer, 30, "%u", timestamp);			/* Flawfinder: ignore */  		row["columns"][4]["column"] = "sort";  		row["columns"][4]["value"] = buffer; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 155e178a5e..9526965334 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -365,7 +365,7 @@ void LLPanelPermissions::refresh()  	else  	{  		char buffer[MAX_STRING];		/*Flawfinder: ignore*/ -		snprintf(buffer, MAX_STRING, "%d Objects, ", obj_count);		/*Flawfinder: ignore*/ +		snprintf(buffer, MAX_STRING, "%d Objects, ", obj_count);			/* Flawfinder: ignore */  		object_info_string.assign(buffer);  	}  	if (1 == prim_count) @@ -375,7 +375,7 @@ void LLPanelPermissions::refresh()  	else  	{  		char buffer[MAX_STRING];		/*Flawfinder: ignore*/ -		snprintf(buffer, MAX_STRING, "%d Primitives", prim_count);		/*Flawfinder: ignore*/ +		snprintf(buffer, MAX_STRING, "%d Primitives", prim_count);			/* Flawfinder: ignore */  		object_info_string.append(buffer);  	}  	childSetText("prim info",object_info_string); diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index c13d76886f..c60a69eb21 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -305,7 +305,7 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **)      S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;  	S32 region_z = llround((F32)pos_global.mdV[VZ]); -    snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z);		/*Flawfinder: ignore*/ +    snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z);			/* Flawfinder: ignore */      location_text.append(buffer);  	S32 sort_order; @@ -340,7 +340,7 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **)          self->mLocationEditor->setText(location_text);          self->mEnabledCheck->set(enabled); -		snprintf(buffer, sizeof(buffer), "%d", sort_order);		/*Flawfinder: ignore*/ +		snprintf(buffer, sizeof(buffer), "%d", sort_order);			/* Flawfinder: ignore */  		self->mSortOrderEditor->setText(buffer);      }  } diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index ade30bf1f9..905cc61560 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -174,16 +174,16 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)  		self->mDescEditor->setText(desc);  		LLString info; -		snprintf(buffer, sizeof(buffer), "Traffic: %.0f, Area: %d sq. m.", dwell, actual_area);		/*Flawfinder: ignore*/ +		snprintf(buffer, sizeof(buffer), "Traffic: %.0f, Area: %d sq. m.", dwell, actual_area);			/* Flawfinder: ignore */  		info.append(buffer);  		if (flags & DFQ_FOR_SALE)  		{ -			snprintf(buffer, sizeof(buffer), ", For Sale for L$%d", sale_price);		/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), ", For Sale for L$%d", sale_price);			/* Flawfinder: ignore */  			info.append(buffer);  		}  		if (auction_id != 0)  		{ -			snprintf(buffer, sizeof(buffer), ", Auction ID %010d", auction_id);		/*Flawfinder: ignore*/ +			snprintf(buffer, sizeof(buffer), ", Auction ID %010d", auction_id);			/* Flawfinder: ignore */  			info.append(buffer);  		}  		self->mInfoEditor->setText(info); @@ -199,7 +199,7 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)  			rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);  		} -		snprintf(buffer, sizeof(buffer), "%s %d, %d, %d (%s)", 		/*Flawfinder: ignore*/ +		snprintf(buffer, sizeof(buffer), "%s %d, %d, %d (%s)", 			/* Flawfinder: ignore */  			sim_name, region_x, region_y, region_z, rating);  		self->mLocationEditor->setText(buffer); @@ -262,7 +262,7 @@ void LLPanelPlace::callbackAuctionWebPage(S32 option, void* data)  	if (0 == option)  	{  		char url[256];		/*Flawfinder: ignore*/ -		snprintf(url, sizeof(url), "%s%010d", AUCTION_URL, self->mAuctionID);		/*Flawfinder: ignore*/ +		snprintf(url, sizeof(url), "%s%010d", AUCTION_URL, self->mAuctionID);			/* Flawfinder: ignore */  		llinfos << "Loading auction page " << url << llendl; diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index e818170ed2..4c4c15a9e2 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -726,7 +726,7 @@ LLPolyMesh *LLPolyMesh::getMesh(const LLString &name, LLPolyMesh* reference_mesh  	// if not found, create a new one, add it to the list  	//-------------------------------------------------------------------------  	char full_path[LL_MAX_PATH];		/*Flawfinder: ignore*/ -	snprintf(full_path, LL_MAX_PATH, "%s", (gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name.c_str())).c_str());		/*Flawfinder: ignore*/ +	snprintf(full_path, LL_MAX_PATH, "%s", (gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name.c_str())).c_str());			/* Flawfinder: ignore */  	LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData();  	if (reference_mesh) @@ -804,7 +804,7 @@ void LLPolyMesh::dumpDiagInfo()  		S32 num_faces = mesh.mNumFaces;  		U32 num_kb = mesh.getNumKB(); -		snprintf(buf, sizeof(buf), "%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name_p->c_str());		/*Flawfinder: ignore*/ +		snprintf(buf, sizeof(buf), "%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name_p->c_str());			/* Flawfinder: ignore */  		llinfos << buf << llendl;  		total_verts += num_verts; @@ -813,7 +813,7 @@ void LLPolyMesh::dumpDiagInfo()  	}  	llinfos << "-----------------------------------------------------" << llendl; -	snprintf(buf, sizeof(buf), "%8d %8d %8d TOTAL", total_verts, total_faces, total_kb );		/*Flawfinder: ignore*/ +	snprintf(buf, sizeof(buf), "%8d %8d %8d TOTAL", total_verts, total_faces, total_kb );			/* Flawfinder: ignore */  	llinfos << buf << llendl;  	llinfos << "-----------------------------------------------------" << llendl;  } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 862dbcf377..6a6b07425f 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -774,7 +774,7 @@ void LLPreviewGesture::refresh()  				mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME);  				mWaitTimeEditor->setVisible(TRUE);  				char buffer[16];		/*Flawfinder: ignore*/ -				snprintf(buffer, sizeof(buffer),  "%.1f", (double)wait_step->mWaitSeconds);		/*Flawfinder: ignore*/ +				snprintf(buffer, sizeof(buffer),  "%.1f", (double)wait_step->mWaitSeconds);			/* Flawfinder: ignore */  				mWaitTimeEditor->setText(buffer);  				break;  			} diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index be6ef4caf4..a44a89dc19 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -586,7 +586,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data  	char uuid_string[UUID_STR_LENGTH];		/*Flawfinder: ignore*/  	asset_uuid.toString(uuid_string);  	char filename[LL_MAX_PATH];		/*Flawfinder: ignore*/ -	snprintf(filename, LL_MAX_PATH, "%s.tmp", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str());		/*Flawfinder: ignore*/ +	snprintf(filename, LL_MAX_PATH, "%s.tmp", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str());			/* Flawfinder: ignore */  	LLFile::remove(filename);  	delete info;  } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index eb86934a54..51ca007d75 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -423,7 +423,7 @@ void LLScriptEdCore::draw()  		S32 column = 0;  		mEditor->getCurrentLineAndColumn( &line, &column, FALSE );  // don't include wordwrap  		char cursor_pos[STD_STRING_BUF_SIZE];		/*Flawfinder: ignore*/ -		snprintf( cursor_pos, STD_STRING_BUF_SIZE, "Line %d, Column %d", line, column );		/*Flawfinder: ignore*/ +		snprintf( cursor_pos, STD_STRING_BUF_SIZE, "Line %d, Column %d", line, column );			/* Flawfinder: ignore */  		childSetText("line_col", cursor_pos);  	}  	else diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4b2445459f..c14b4461d6 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2059,7 +2059,7 @@ void LLSelectMgr::packGodlikeHead(void* user_data)  void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)  {  	char buf [MAX_STRING];		/* Flawfinder: ignore */ -	snprintf(buf, MAX_STRING, "%u", node->getObject()->getLocalID());		/* Flawfinder: ignore */ +	snprintf(buf, MAX_STRING, "%u", node->getObject()->getLocalID());			/* Flawfinder: ignore */  	gMessageSystem->nextBlock("ParamList");  	gMessageSystem->addString("Parameter", buf);  } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f8cc68d683..92f39f265e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -747,7 +747,7 @@ BOOL idle_startup()  			if (gUserServerChoice == USERSERVER_OTHER)  			{  				gUserServer.setHostByName( server_label.c_str() ); -				snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str());		/* Flawfinder: ignore */ +				snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str());			/* Flawfinder: ignore */  			}  		} diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0cce868b4a..cbbc2ac6cd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5383,7 +5383,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,  		LLString short_name = filename.substr(offset);  		// No extension -		snprintf(error_message,		/* Flawfinder: ignore */	 +		snprintf(error_message,		/* Flawfinder: ignore */  				MAX_STRING,  				"No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",  				short_name.c_str()); @@ -5532,7 +5532,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,                           else	 	                           {	 	                                   fclose(in);	 	 -                                 snprintf(error_message, MAX_STRING, "unknown linden resource file version in file: %s", src_filename.c_str());		/* Flawfinder: ignore */	 	 +                                 snprintf(error_message, MAX_STRING, "unknown linden resource file version in file: %s", src_filename.c_str());		/* Flawfinder: ignore */  								 args["[FILE]"] = src_filename;  								 upload_error(error_message, "UnknownResourceFileVersion", filename, args);                                   return; @@ -5568,7 +5568,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,                   else	 	                   {	 	                           fclose(in);	 	 -                         snprintf(error_message, MAX_STRING, "Unable to create output file: %s", filename.c_str());		/* Flawfinder: ignore */	 	 +                         snprintf(error_message, MAX_STRING, "Unable to create output file: %s", filename.c_str());		/* Flawfinder: ignore */  						 args["[FILE]"] = filename;  						 upload_error(error_message, "UnableToCreateOutputFile", filename, args);                           return; diff --git a/indra/test/lltut.h b/indra/test/lltut.h index c2ec504857..99dd71b78c 100644 --- a/indra/test/lltut.h +++ b/indra/test/lltut.h @@ -26,6 +26,22 @@ class LLSD;  namespace tut  { +	inline void ensure_memory_matches(const char* msg,const void* actual, U32 actual_len, const void* expected,U32 expected_len) +	{ +		if((expected_len != actual_len) ||  +			(memcmp(actual, expected, actual_len) != 0)) +		{ +			std::stringstream ss; +			ss << (msg?msg:"") << (msg?": ":"") << "not equal"; +			throw tut::failure(ss.str().c_str()); +		} +	} + +	inline void ensure_memory_matches(const void* actual, U32 actual_len, const void* expected,U32 expected_len) +	{ +		ensure_memory_matches(NULL, actual, actual_len, expected, expected_len); +	} +  	template <class T,class Q>  	void ensure_not_equals(const char* msg,const Q& actual,const T& expected)  	{ diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 312c52dc77..b60abdf587 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -43,7 +43,8 @@ public:  		mVerboseMode(verbose_mode),  		mTotalTests(0),  		mPassedTests(0), -		mFailedTests(0) +		mFailedTests(0), +		mSkippedTests(0)  	{  	} @@ -79,6 +80,10 @@ public:  			++mFailedTests;  			out << "abnormal termination";  			break; +		case tut::test_result::skip: +			++mSkippedTests; +			out << "skipped"; +			break;  		default:  			++mFailedTests;  			out << "unknown"; @@ -94,6 +99,12 @@ public:  		std::cout << std::endl;  		std::cout << "Total Tests:   " << mTotalTests << std::endl;  		std::cout << "Passed Tests : " << mPassedTests << std::endl; +		 +		if (mSkippedTests > 0) +		{ +			std::cout << "Skipped Tests : " << mSkippedTests << std::endl; +		} +  		if(mFailedTests > 0)  		{  			std::cout << "*********************************" << std::endl; @@ -109,6 +120,7 @@ protected:  	S32 mTotalTests;  	S32 mPassedTests;  	S32 mFailedTests; +	S32 mSkippedTests;  };  static const apr_getopt_option_t TEST_CL_OPTIONS[] = @@ -117,6 +129,7 @@ static const apr_getopt_option_t TEST_CL_OPTIONS[] =  	{"list", 'l', 0, "List available test groups."},  	{"verbose", 'v', 0, "Verbose output."},  	{"group", 'g', 1, "Run test group specified by option argument."}, +	{"skip", 's', 1, "Skip test number specified by option argument. Only works when a specific group is being tested"},  	{"wait", 'w', 0, "Wait for input before exit."},  	{0, 0, 0, 0}  }; @@ -146,6 +159,8 @@ void stream_usage(std::ostream& s, const char* app)  	s << "\tList all available test groups." << std::endl;  	s << "  " << app << " --group=uuid" << std::endl;  	s << "\tRun the test group 'uuid'." << std::endl; +	s << "  " << app << " --skip=2" << std::endl; +	s << "\tSkip test case 2." << std::endl;  }  void stream_groups(std::ostream& s, const char* app) @@ -193,6 +208,7 @@ int main(int argc, char **argv)  	// values used for controlling application  	bool verbose_mode = false;  	bool wait_at_exit = false; +	int  skip_test_id = 0;  	std::string test_group;  	// values use for options parsing @@ -215,6 +231,9 @@ int main(int argc, char **argv)  		case 'g':  			test_group.assign(opt_arg);  			break; +		case 's': +			skip_test_id = atoi(opt_arg); +			break;			  		case 'h':  			stream_usage(std::cout, argv[0]);  			return 0; @@ -245,7 +264,7 @@ int main(int argc, char **argv)  	}  	else  	{ -		tut::runner.get().run_tests(test_group); +		tut::runner.get().run_tests(test_group, skip_test_id);  	}  	if (wait_at_exit) diff --git a/indra/win_updater/updater.cpp b/indra/win_updater/updater.cpp index 11ccb559c6..96ffd5f66a 100644 --- a/indra/win_updater/updater.cpp +++ b/indra/win_updater/updater.cpp @@ -14,6 +14,7 @@  #include <wininet.h>  #include <stdio.h> +#include <stdarg.h>  #include "llpreprocessor.h"  #include "llfile.h" @@ -488,11 +489,13 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho  	char params[2048];		/* Flawfinder: ignore */  	if (gIsSilent && gProgramName)  	{ -		snprintf(params, sizeof(params), "/S /P=\"%s\"", gProgramName);		/* Flawfinder: ignore */ +		_snprintf(params, sizeof(params), "/S /P=\"%s\"", gProgramName);		/* Flawfinder: ignore */ +		params[2047] = '\0';  	}  	else if (gProgramName)  	{ -		snprintf(params, sizeof(params), "/P=\"%s\"", gProgramName);		/* Flawfinder: ignore */ +		_snprintf(params, sizeof(params), "/P=\"%s\"", gProgramName);		/* Flawfinder: ignore */ +		params[2047] = '\0';  	}  	else if (gIsSilent)  	{ | 
