summaryrefslogtreecommitdiff
path: root/indra/lscript/lscript_library
diff options
context:
space:
mode:
authorAaron Brashears <aaronb@lindenlab.com>2007-02-02 17:28:58 +0000
committerAaron Brashears <aaronb@lindenlab.com>2007-02-02 17:28:58 +0000
commit305c74d5163c5e344a675d39ca2394a9e45bd2c2 (patch)
tree42836c4a6010b2b015156024d3cfb6bf64a48ad6 /indra/lscript/lscript_library
parent54d89549df38bb61881583a3eb8d3645c107d79f (diff)
Result of svn merge -r57264:57370 svn+ssh://svn/svn/linden/branches/adroit.r40-68 into release.
Diffstat (limited to 'indra/lscript/lscript_library')
-rw-r--r--indra/lscript/lscript_library/lscript_alloc.cpp36
-rw-r--r--indra/lscript/lscript_library/lscript_library.cpp31
2 files changed, 40 insertions, 27 deletions
diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp
index 86c8729e9c..f26fef6d77 100644
--- a/indra/lscript/lscript_library/lscript_alloc.cpp
+++ b/indra/lscript/lscript_library/lscript_alloc.cpp
@@ -108,10 +108,10 @@ S32 lsa_heap_add_data(U8 *buffer, LLScriptLibData *data, S32 heapsize, BOOL b_de
size = 4;
break;
case LST_KEY:
- size = (S32)strlen(data->mKey) + 1;
+ size = (S32)strlen(data->mKey) + 1; /*Flawfinder: ignore*/
break;
case LST_STRING:
- size = (S32)strlen(data->mString) + 1;
+ size = (S32)strlen(data->mString) + 1; /*Flawfinder: ignore*/
break;
case LST_LIST:
// list data 4 bytes of number of entries followed by number of pointer
@@ -335,7 +335,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
{
if (data->mString)
{
- size = (S32)strlen(data->mString) + 1;
+ size = (S32)strlen(data->mString) + 1; /*Flawfinder: ignore*/
}
else
{
@@ -346,7 +346,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
{
if (data->mKey)
{
- size = (S32)strlen(data->mKey) + 1;
+ size = (S32)strlen(data->mKey) + 1; /*Flawfinder: ignore*/
}
else
{
@@ -413,8 +413,12 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
if (listsize)
{
U8 *tbuff = new U8[size + listsize];
- memcpy(tbuff, *buffer, size);
- memcpy(tbuff + size, listbuf, listsize);
+ if (tbuff == NULL)
+ {
+ llerrs << "Memory Allocation Failed" << llendl;
+ }
+ memcpy(tbuff, *buffer, size); /*Flawfinder: ignore*/
+ memcpy(tbuff + size, listbuf, listsize); /*Flawfinder: ignore*/
size += listsize;
delete [] *buffer;
delete [] listbuf;
@@ -497,7 +501,7 @@ void lsa_decrease_ref_count(U8 *buffer, S32 offset)
alloc_entry2bytestream(buffer, orig_offset, entry);
}
-char gLSAStringRead[16384];
+char gLSAStringRead[16384]; /*Flawfinder: ignore*/
LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref)
@@ -538,13 +542,13 @@ LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref)
break;
case LST_KEY:
bytestream2char(gLSAStringRead, buffer, offset);
- retval->mKey = new char[strlen(gLSAStringRead) + 1];
- strcpy(retval->mKey, gLSAStringRead);
+ retval->mKey = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/
+ strcpy(retval->mKey, gLSAStringRead); /*Flawfinder: ignore*/
break;
case LST_STRING:
bytestream2char(gLSAStringRead, buffer, offset);
- retval->mString = new char[strlen(gLSAStringRead) + 1];
- strcpy(retval->mString, gLSAStringRead);
+ retval->mString = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/
+ strcpy(retval->mString, gLSAStringRead); /*Flawfinder: ignore*/
break;
case LST_VECTOR:
bytestream2vector(retval->mVec, buffer, offset);
@@ -684,13 +688,13 @@ S32 lsa_cat_strings(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
return 0;
}
- S32 size = (S32)strlen(test1) + (S32)strlen(test2) + 1;
+ S32 size = (S32)strlen(test1) + (S32)strlen(test2) + 1; /*Flawfinder: ignore*/
LLScriptLibData *string3 = new LLScriptLibData;
string3->mType = LST_STRING;
string3->mString = new char[size];
- strcpy(string3->mString, test1);
- strcat(string3->mString, test2);
+ strcpy(string3->mString, test1); /*Flawfinder: ignore*/
+ strcat(string3->mString, test2); /*Flawfinder: ignore*/
delete string1;
delete string2;
@@ -760,7 +764,7 @@ void lsa_print_heap(U8 *buffer)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
- char string[4096];
+ char string[4096]; /*Flawfinder: ignore*/
LLScriptAllocEntry entry;
@@ -830,7 +834,7 @@ void lsa_fprint_heap(U8 *buffer, FILE *fp)
F32 fpvalue;
LLVector3 vvalue;
LLQuaternion qvalue;
- char string[4096];
+ char string[4096]; /*Flawfinder: ignore*/
LLScriptAllocEntry entry;
diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp
index 1af10ae9c4..eef3621d47 100644
--- a/indra/lscript/lscript_library/lscript_library.cpp
+++ b/indra/lscript/lscript_library/lscript_library.cpp
@@ -433,11 +433,17 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun
mDesc = new char[512];
if (mSleepTime)
{
- sprintf(mDesc,"%s\nSleeps script for %.1f seconds.",desc,mSleepTime);
+ snprintf( /* Flawfinder: ignore */
+ mDesc,
+ 512,
+ "%s\nSleeps script for %.1f seconds.",
+ desc,
+ mSleepTime);
}
else
{
- strcpy(mDesc,desc);
+ strncpy(mDesc, desc, 512); /* Flawfinder: ignore */
+ mDesc[511] = '\0'; // just in case.
}
}
@@ -451,7 +457,10 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func)
LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1];
if (mNextNumber)
{
- memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber);
+ memcpy( /* Flawfinder: ignore */
+ temp,
+ mFunctions,
+ sizeof(LLScriptLibraryFunction*)*mNextNumber);
delete [] mFunctions;
}
mFunctions = temp;
@@ -473,7 +482,7 @@ void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *
void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
{
- char tmp[1024];
+ char tmp[1024]; /*Flawfinder: ignore*/
if (b_prepend_comma)
{
s << ", ";
@@ -484,7 +493,7 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
s << mInteger;
break;
case LST_FLOATINGPOINT:
- snprintf(tmp, 1024, "%f", mFP);
+ snprintf(tmp, 1024, "%f", mFP); /*Flawfinder: ignore*/
s << tmp;
break;
case LST_KEY:
@@ -494,12 +503,12 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
s << mString;
break;
case LST_VECTOR:
- snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
+ snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
mVec.mV[VY], mVec.mV[VZ]);
s << tmp;
break;
case LST_QUATERNION:
- snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
+ snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
mQuat.mQ[VZ], mQuat.mQ[VS]);
s << tmp;
break;
@@ -517,7 +526,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
//print(ostr, FALSE);
{
BOOL b_prepend_comma = FALSE;
- char tmp[1024];
+ char tmp[1024]; /* Flawfinder: ignore */
if (b_prepend_comma)
{
ostr << ", ";
@@ -528,7 +537,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
ostr << mInteger;
break;
case LST_FLOATINGPOINT:
- snprintf(tmp, 1024, "%f", mFP);
+ snprintf(tmp, 1024, "%f", mFP); /* Flawfinder: ignore */
ostr << tmp;
break;
case LST_KEY:
@@ -538,12 +547,12 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
ostr << mString;
break;
case LST_VECTOR:
- snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
+ snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
mVec.mV[VY], mVec.mV[VZ]);
ostr << tmp;
break;
case LST_QUATERNION:
- snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
+ snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
mQuat.mQ[VZ], mQuat.mQ[VS]);
ostr << tmp;
break;