diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/lscript/lscript_byteconvert.h | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_library/lscript_alloc.cpp | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h index 6d0e2d08f3..923b2b402d 100644 --- a/indra/lscript/lscript_byteconvert.h +++ b/indra/lscript/lscript_byteconvert.h @@ -168,7 +168,7 @@ inline void bytestream2char(char *buffer, const U8 *stream, S32 &offset) ; } -inline void char2bytestream(U8 *stream, S32 &offset, char *buffer) +inline void char2bytestream(U8 *stream, S32 &offset, const char *buffer) { while ((*(stream + offset++) = *buffer++)) ; diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp index a2f83e7cd9..dac83eb3a8 100644 --- a/indra/lscript/lscript_library/lscript_alloc.cpp +++ b/indra/lscript/lscript_library/lscript_alloc.cpp @@ -131,10 +131,12 @@ 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; /*Flawfinder: ignore*/ + // NOTE: babbage: defensive as some library calls set data to NULL + size = data->mKey ? (S32)strlen(data->mKey) + 1 : 1; /*Flawfinder: ignore*/ break; case LST_STRING: - size = (S32)strlen(data->mString) + 1; /*Flawfinder: ignore*/ + // NOTE: babbage: defensive as some library calls set data to NULL + size = data->mString ? (S32)strlen(data->mString) + 1 : 1; /*Flawfinder: ignore*/ break; case LST_LIST: // list data 4 bytes of number of entries followed by number of pointer @@ -294,10 +296,10 @@ void lsa_insert_data(U8 *buffer, S32 &offset, LLScriptLibData *data, LLScriptAll float2bytestream(buffer, offset, data->mFP); break; case LST_KEY: - char2bytestream(buffer, offset, data->mKey); + char2bytestream(buffer, offset, data->mKey ? data->mKey : ""); break; case LST_STRING: - char2bytestream(buffer, offset, data->mString); + char2bytestream(buffer, offset, data->mString ? data->mString : ""); break; case LST_VECTOR: vector2bytestream(buffer, offset, data->mVec); |