diff options
-rw-r--r-- | indra/llinventory/llparcel.cpp | 3 | ||||
-rw-r--r-- | indra/lscript/lscript_byteconvert.h | 35 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/lscript_execute.cpp | 28 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/lscript_readlso.cpp | 184 | ||||
-rw-r--r-- | indra/lscript/lscript_library.h | 8 | ||||
-rw-r--r-- | indra/lscript/lscript_library/lscript_alloc.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 10 |
7 files changed, 155 insertions, 127 deletions
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 792bb1be90..7a84e1916f 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -1337,7 +1337,7 @@ void LLParcel::packMessage(LLMessageSystem* msg) void LLParcel::packMessage(LLSD& msg) { msg["local_id"] = getLocalID(); - msg["flags"] = ll_sd_from_U32(getParcelFlags()); + msg["parcel_flags"] = ll_sd_from_U32(getParcelFlags()); msg["sale_price"] = getSalePrice(); msg["name"] = getName(); msg["description"] = getDesc(); @@ -1362,6 +1362,7 @@ void LLParcel::packMessage(LLSD& msg) msg["user_location"] = ll_sd_from_vector3(mUserLocation); msg["user_look_at"] = ll_sd_from_vector3(mUserLookAt); msg["landing_type"] = (U8)mLandingType; + } diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h index 923b2b402d..d0a5d574d0 100644 --- a/indra/lscript/lscript_byteconvert.h +++ b/indra/lscript/lscript_byteconvert.h @@ -162,10 +162,16 @@ inline void bytestream_int2float(U8 *stream, S32 &offset) float2bytestream(stream, offset, fpvalue); } -inline void bytestream2char(char *buffer, const U8 *stream, S32 &offset) +// Returns true on success, return false and clip copy on buffer overflow +inline bool bytestream2char(char *buffer, const U8 *stream, S32 &offset, S32 buffsize) { - while ((*buffer++ = *(stream + offset++))) - ; + S32 source_len = strlen( (const char *)stream+offset ); + strncpy( buffer, (const char *)stream+offset, buffsize-1 ); + buffer[buffsize-1] = 0; + + offset += source_len + 1; // advance past source string, include terminating '\0' + + return source_len < buffsize; } inline void char2bytestream(U8 *stream, S32 &offset, const char *buffer) @@ -1065,11 +1071,30 @@ inline void safe_instruction_float2bytestream(U8 *stream, S32 &offset, F32 value } } -inline void safe_instruction_bytestream2char(char *buffer, U8 *stream, S32 &offset) +inline void safe_instruction_bytestream2char(char *buffer, U8 *stream, S32 &offset, S32 buffsize) { - while ( (safe_instruction_check_address(stream, offset, 1)) + bool safe; + while ( (safe = safe_instruction_check_address(stream, offset, 1)) + && buffsize-- &&(*buffer++ = *(stream + offset++))) ; + + // Return if it ended in a null (success) or if script error handling is taking over + if( !safe || (0 == *(buffer-1)) ) + { + return; // Yep. Success. + } + + // Defensive mode. We copied at least one char and ran out of space before + // null termination. Add the terminator... + *(buffer-1) = 0; + + // ...and advance offset past the end of the data as if we copied the rest. If we + // violate the safety check, script error handling will protect us. No need to + // keep advancing. + while( safe_instruction_check_address(stream, offset, 1) + && *( stream + offset++ ) ) + ; } inline void safe_instruction_bytestream_count_char(U8 *stream, S32 &offset) diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 5bbbc47c63..12b55c8ea8 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -1333,7 +1333,7 @@ BOOL run_pushargs(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) S32 size = toffset - offset; char *arg = new char[size]; offset++; - safe_instruction_bytestream2char(arg, buffer, offset); + safe_instruction_bytestream2char(arg, buffer, offset, size); if (b_print) printf("%s\n", arg); S32 address = lsa_heap_add_data(buffer, new LLScriptLibData(arg), get_max_heap_size(buffer), TRUE); @@ -2753,7 +2753,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *sdata = new char[size]; - bytestream2char(sdata, buffer, string); + bytestream2char(sdata, buffer, string, size); if (strlen(sdata)) /*Flawfinder: ignore*/ { offset += arg; @@ -2781,7 +2781,7 @@ BOOL run_jumpif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *sdata = new char[size]; - bytestream2char(sdata, buffer, string); + bytestream2char(sdata, buffer, string, size); if (strlen(sdata)) /*Flawfinder: ignore*/ { LLUUID id; @@ -2880,7 +2880,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *sdata = new char[size]; - bytestream2char(sdata, buffer, string); + bytestream2char(sdata, buffer, string, size); if (!strlen(sdata)) /*Flawfinder: ignore*/ { offset += arg; @@ -2908,7 +2908,7 @@ BOOL run_jumpnif(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *sdata = new char[size]; - bytestream2char(sdata, buffer, string); + bytestream2char(sdata, buffer, string, size); if (strlen(sdata)) /*Flawfinder: ignore*/ { LLUUID id; @@ -3182,7 +3182,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *arg = new char[size]; - bytestream2char(arg, buffer, string); + bytestream2char(arg, buffer, string, size); // S32 length = strlen(arg); S32 dest; S32 base; @@ -3225,7 +3225,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *arg = new char[size]; - bytestream2char(arg, buffer, string); + bytestream2char(arg, buffer, string, size); F32 dest = (F32)atof(arg); @@ -3265,7 +3265,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *arg = new char[size]; - bytestream2char(arg, buffer, string); + bytestream2char(arg, buffer, string, size); LLVector3 vec; S32 num = sscanf(arg, "<%f, %f, %f>", &vec.mV[VX], &vec.mV[VY], &vec.mV[VZ]); if (num != 3) @@ -3295,7 +3295,7 @@ BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *arg = new char[size]; - bytestream2char(arg, buffer, string); + bytestream2char(arg, buffer, string, size); LLQuaternion quat; S32 num = sscanf(arg, "<%f, %f, %f, %f>", &quat.mQ[VX], &quat.mQ[VY], &quat.mQ[VZ], &quat.mQ[VW]); if (num != 4) @@ -3496,7 +3496,7 @@ void lscript_stacktol_pop_variable(LLScriptLibData *data, U8 *buffer, char type) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; data->mKey = new char[size]; - bytestream2char(data->mKey, buffer, string); + bytestream2char(data->mKey, buffer, string, size); } lsa_decrease_ref_count(buffer, base_address); } @@ -3523,7 +3523,7 @@ void lscript_stacktol_pop_variable(LLScriptLibData *data, U8 *buffer, char type) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; data->mString = new char[size]; - bytestream2char(data->mString, buffer, string); + bytestream2char(data->mString, buffer, string, size); } lsa_decrease_ref_count(buffer, base_address); } @@ -3623,7 +3623,7 @@ BOOL run_print(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; char *arg = new char[size]; - bytestream2char(arg, buffer, string); + bytestream2char(arg, buffer, string, size); printf("%s\n", arg); delete [] arg; } @@ -3787,7 +3787,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; data->mKey = new char[size]; - bytestream2char(data->mKey, buffer, string); + bytestream2char(data->mKey, buffer, string, size); } lsa_decrease_ref_count(buffer, base_address); } @@ -3814,7 +3814,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) safe_heap_bytestream_count_char(buffer, toffset); S32 size = toffset - string; data->mString = new char[size]; - bytestream2char(data->mString, buffer, string); + bytestream2char(data->mString, buffer, string, size); } lsa_decrease_ref_count(buffer, base_address); } diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp index 8ecd8cd28c..e949374258 100644 --- a/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/indra/lscript/lscript_execute/lscript_readlso.cpp @@ -155,7 +155,7 @@ void LLScriptLSOParse::printGlobals(FILE *fp) type = *(mRawData + global_v_offset++); // set name - bytestream2char(name, mRawData, global_v_offset); + bytestream2char(name, mRawData, global_v_offset, sizeof(name)); switch(type) { @@ -261,7 +261,7 @@ void LLScriptLSOParse::printGlobalFunctions(FILE *fp) // where do the opcodes start opcode_start = bytestream2integer(mRawData, function_offset); opcode_start += orig_function_offset; - bytestream2char(name, mRawData, function_offset); + bytestream2char(name, mRawData, function_offset, sizeof(name)); // get return type type = *(mRawData + function_offset++); fprintf(fp, "[Function #%d] [0x%X] %s\n", function_number, orig_function_offset, name); @@ -272,7 +272,7 @@ void LLScriptLSOParse::printGlobalFunctions(FILE *fp) S32 pcount = 0; while (type) { - bytestream2char(name, mRawData, function_offset); + bytestream2char(name, mRawData, function_offset, sizeof(name)); fprintf(fp, "\tParameter #%d: %s %s\n", pcount++, LSCRIPTTypeNames[type], name); type = *(mRawData + function_offset++); } @@ -336,7 +336,7 @@ void LLScriptLSOParse::printStates(FILE *fp) state_info_offset += state_offset; fprintf(fp, "[0x%X] ", state_info_offset); state_info_offset += LSCRIPTDataSize[LST_INTEGER]; - bytestream2char(name, mRawData, state_info_offset); + bytestream2char(name, mRawData, state_info_offset, sizeof(name)); fprintf(fp, "%s\n", name); event_jump_table = state_info_offset; @@ -385,243 +385,243 @@ void LLScriptLSOParse::printStates(FILE *fp) switch(j) { case LSTT_STATE_ENTRY: // LSTT_STATE_ENTRY - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_STATE_EXIT: // LSTT_STATE_EXIT - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_TOUCH_START: // LSTT_TOUCH_START - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_TOUCH: // LSTT_TOUCH - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_TOUCH_END: // LSTT_TOUCH_END - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_COLLISION_START: // LSTT_COLLISION_START - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_COLLISION: // LSTT_COLLISION - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_COLLISION_END: // LSTT_COLLISION_END - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_LAND_COLLISION_START: // LSTT_LAND_COLLISION_START - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_LAND_COLLISION: // LSTT_LAND_COLLISION - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_LAND_COLLISION_END: // LSTT_LAND_COLLISION_END - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_INVENTORY: // LSTT_INVENTORY - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); break; case LSTT_ATTACH: // LSTT_ATTACH - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); break; case LSTT_DATASERVER: // LSTT_DATASERVER - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); break; case LSTT_TIMER: // LSTT_TIMER - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_MOVING_START: // LSTT_MOVING_START - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_MOVING_END: // LSTT_MOVING_END - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_CHAT: // LSTT_CHAT - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); break; case LSTT_OBJECT_REZ: // LSTT_OBJECT_REZ - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); break; case LSTT_REMOTE_DATA: // LSTT_REMOTE_DATA - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); break; case LSTT_REZ: // LSTT_REZ - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_SENSOR: // LSTT_SENSOR - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); break; case LSTT_NO_SENSOR: // LSTT_NO_SENSOR - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_CONTROL: // LSTT_CONTROL - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); break; case LSTT_LINK_MESSAGE: // LSTT_LINK_MESSAGE - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); break; case LSTT_MONEY: // LSTT_MONEY - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); break; case LSTT_EMAIL: // LSTT_EMAIL - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); break; case LSTT_AT_TARGET: // LSTT_AT_TARGET - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tvector %s\n", name); break; case LSTT_NOT_AT_TARGET: // LSTT_NOT_AT_TARGET - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_AT_ROT_TARGET: // LSTT_AT_ROT_TARGET - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tquaternion %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tquaternion %s\n", name); break; case LSTT_NOT_AT_ROT_TARGET: // LSTT_NOT_AT_TARGET - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); break; case LSTT_RTPERMISSIONS: // LSTT_RTPERMISSIONS - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); break; case LSTT_HTTP_RESPONSE: // LSTT_REMOTE_DATA ?!?!?! - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "%s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tkey %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tinteger %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tlist %s\n", name); - bytestream2char(name, mRawData, event_offset); + bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); break; default: @@ -1210,7 +1210,7 @@ void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) char arg[1024]; /*Flawfinder: ignore*/ lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHARGS ", offset++); - bytestream2char(arg, buffer, offset); + bytestream2char(arg, buffer, offset, sizeof(arg)); fprintf(fp, "%s\n", arg); } diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index a15805fd11..d9702ced84 100644 --- a/indra/lscript/lscript_library.h +++ b/indra/lscript/lscript_library.h @@ -278,7 +278,7 @@ public: break; case LST_KEY: { - bytestream2char(temp, src, offset); + bytestream2char(temp, src, offset, sizeof(temp)); mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mKey == NULL) { @@ -290,7 +290,7 @@ public: break; case LST_STRING: { - bytestream2char(temp, src, offset); + bytestream2char(temp, src, offset, sizeof(temp)); mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { @@ -327,7 +327,7 @@ public: break; case LST_KEY: { - bytestream2char(temp, src, offset); + bytestream2char(temp, src, offset, sizeof(temp)); mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mKey == NULL) { @@ -339,7 +339,7 @@ public: break; case LST_STRING: { - bytestream2char(temp, src, offset); + bytestream2char(temp, src, offset, sizeof(temp)); mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp index dac83eb3a8..519ef9fb8c 100644 --- a/indra/lscript/lscript_library/lscript_alloc.cpp +++ b/indra/lscript/lscript_library/lscript_alloc.cpp @@ -526,7 +526,7 @@ void lsa_decrease_ref_count(U8 *buffer, S32 offset) alloc_entry2bytestream(buffer, orig_offset, entry); } -char gLSAStringRead[16384]; /*Flawfinder: ignore*/ +char gLSAStringRead[TOP_OF_MEMORY]; /*Flawfinder: ignore*/ LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref) @@ -566,12 +566,12 @@ LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref) retval->mFP = bytestream2float(buffer, offset); break; case LST_KEY: - bytestream2char(gLSAStringRead, buffer, offset); + bytestream2char(gLSAStringRead, buffer, offset, sizeof(gLSAStringRead)); // global sring buffer? for real? :( retval->mKey = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/ strcpy(retval->mKey, gLSAStringRead); /*Flawfinder: ignore*/ break; case LST_STRING: - bytestream2char(gLSAStringRead, buffer, offset); + bytestream2char(gLSAStringRead, buffer, offset, sizeof(gLSAStringRead)); retval->mString = new char[strlen(gLSAStringRead) + 1]; /*Flawfinder: ignore*/ strcpy(retval->mString, gLSAStringRead); /*Flawfinder: ignore*/ break; @@ -818,11 +818,11 @@ void lsa_print_heap(U8 *buffer) printf("%f\n", fpvalue); break; case LST_STRING: - bytestream2char(string, buffer, readoffset); + bytestream2char(string, buffer, readoffset, sizeof(string)); printf("%s\n", string); break; case LST_KEY: - bytestream2char(string, buffer, readoffset); + bytestream2char(string, buffer, readoffset, sizeof(string)); printf("%s\n", string); break; case LST_VECTOR: @@ -885,11 +885,11 @@ void lsa_fprint_heap(U8 *buffer, FILE *fp) fprintf(fp, "%f\n", fpvalue); break; case LST_STRING: - bytestream2char(string, buffer, readoffset); + bytestream2char(string, buffer, readoffset, sizeof(string)); fprintf(fp, "%s\n", string); break; case LST_KEY: - bytestream2char(string, buffer, readoffset); + bytestream2char(string, buffer, readoffset, sizeof(string)); fprintf(fp, "%s\n", string); break; case LST_VECTOR: diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index e027588eaa..b5c2e81ab7 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -56,6 +56,7 @@ #include "llnotify.h" #include "llparcelselection.h" #include "llresmgr.h" +#include "llsdutil.h" #include "llstatusbar.h" #include "llui.h" #include "llviewerimage.h" @@ -1267,6 +1268,9 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag std::string url = gAgent.getRegion()->getCapability("ParcelPropertiesUpdate"); if (!url.empty()) { + U32 message_flags = 0x01; + // request new properties update from simulator + body["flags"] = ll_sd_from_U32(message_flags); parcel->packMessage(body); llinfos << "Sending parcel properties update via capability to:" << url << llendl; @@ -1284,10 +1288,8 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() ); - U32 flags = 0x0; - // request new properties update from simulator - flags |= 0x01; - msg->addU32("Flags", flags); + U32 message_flags = 0x01; + msg->addU32("Flags", message_flags); parcel->packMessage(msg); |