diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2007-02-02 17:28:58 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2007-02-02 17:28:58 +0000 |
commit | 305c74d5163c5e344a675d39ca2394a9e45bd2c2 (patch) | |
tree | 42836c4a6010b2b015156024d3cfb6bf64a48ad6 /indra/lscript/lscript_library/lscript_alloc.cpp | |
parent | 54d89549df38bb61881583a3eb8d3645c107d79f (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/lscript_alloc.cpp')
-rw-r--r-- | indra/lscript/lscript_library/lscript_alloc.cpp | 36 |
1 files changed, 20 insertions, 16 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; |