aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/message.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage/message.cpp')
-rw-r--r--linden/indra/llmessage/message.cpp130
1 files changed, 64 insertions, 66 deletions
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index 5baefff..2e7cb6a 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -987,7 +987,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
987 987
988 LLMessageVariable var; 988 LLMessageVariable var;
989 char var_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */ 989 char var_name[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */
990 char formatString[MAX_MESSAGE_INTERNAL_NAME_SIZE]; 990 char formatString[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */
991 991
992 FILE* messagefilep = NULL; 992 FILE* messagefilep = NULL;
993 mMessageFileChecksum = 0; 993 mMessageFileChecksum = 0;
@@ -995,14 +995,19 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
995 S32 checksum_offset = 0; 995 S32 checksum_offset = 0;
996 char* checkp = NULL; 996 char* checkp = NULL;
997 997
998 snprintf(formatString, sizeof(formatString), "%%%ds", MAX_MESSAGE_INTERNAL_NAME_SIZE); 998 // scanf needs 1 byte more than width, thus the MAX_... -1.
999 messagefilep = LLFile::fopen(filename, "r"); 999 snprintf( /* Flawfinder: ignore */
1000 formatString,
1001 sizeof(formatString),
1002 "%%%ds",
1003 MAX_MESSAGE_INTERNAL_NAME_SIZE - 1);
1004 messagefilep = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */
1000 if (messagefilep) 1005 if (messagefilep)
1001 { 1006 {
1002// mName = gMessageStringTable.getString(filename); 1007// mName = gMessageStringTable.getString(filename);
1003 1008
1004 fseek(messagefilep, 0L, SEEK_SET ); 1009 fseek(messagefilep, 0L, SEEK_SET );
1005 while(fscanf(messagefilep, formatString, token) != EOF) 1010 while(fscanf(messagefilep, formatString, token) != EOF) /* Flawfinder: ignore */
1006 { 1011 {
1007 // skip comments 1012 // skip comments
1008 if (token[0] == '/') 1013 if (token[0] == '/')
@@ -1132,7 +1137,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1132 b_template = FALSE; 1137 b_template = FALSE;
1133 1138
1134 // name first 1139 // name first
1135 if (fscanf(messagefilep, formatString, template_name) == EOF) 1140 if (fscanf(messagefilep, formatString, template_name) == EOF) /* Flawfinder: ignore */
1136 { 1141 {
1137 // oops, file ended 1142 // oops, file ended
1138 llerrs << "Expected message template name, but file ended" 1143 llerrs << "Expected message template name, but file ended"
@@ -1164,7 +1169,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1164 } 1169 }
1165 1170
1166 // ok, now get Frequency ("High", "Medium", or "Low") 1171 // ok, now get Frequency ("High", "Medium", or "Low")
1167 if (fscanf(messagefilep, formatString, token) == EOF) 1172 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1168 { 1173 {
1169 // oops, file ended 1174 // oops, file ended
1170 llerrs << "Expected message template frequency, found EOF." 1175 llerrs << "Expected message template frequency, found EOF."
@@ -1245,7 +1250,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1245 else if (!strcmp(token, "Fixed")) 1250 else if (!strcmp(token, "Fixed"))
1246 { 1251 {
1247 U32 message_num = 0; 1252 U32 message_num = 0;
1248 if (fscanf(messagefilep, formatString, token) == EOF) 1253 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1249 { 1254 {
1250 // oops, file ended 1255 // oops, file ended
1251 llerrs << "Expected message template number (fixed)," 1256 llerrs << "Expected message template number (fixed),"
@@ -1279,7 +1284,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1279 } 1284 }
1280 1285
1281 // Now get trust ("Trusted", "NotTrusted") 1286 // Now get trust ("Trusted", "NotTrusted")
1282 if (fscanf(messagefilep, formatString, token) == EOF) 1287 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1283 { 1288 {
1284 // File ended 1289 // File ended
1285 llerrs << "Expected message template " 1290 llerrs << "Expected message template "
@@ -1316,7 +1321,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1316 } 1321 }
1317 1322
1318 // get encoding 1323 // get encoding
1319 if (fscanf(messagefilep, formatString, token) == EOF) 1324 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1320 { 1325 {
1321 // File ended 1326 // File ended
1322 llerrs << "Expected message encoding, but file ended." 1327 llerrs << "Expected message encoding, but file ended."
@@ -1362,7 +1367,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1362 // ok, need to pull header info 1367 // ok, need to pull header info
1363 1368
1364 // name first 1369 // name first
1365 if (fscanf(messagefilep, formatString, block_name) == EOF) 1370 if (fscanf(messagefilep, formatString, block_name) == EOF) /* Flawfinder: ignore */
1366 { 1371 {
1367 // oops, file ended 1372 // oops, file ended
1368 llerrs << "Expected block name, but file ended" << llendl; 1373 llerrs << "Expected block name, but file ended" << llendl;
@@ -1390,7 +1395,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1390 } 1395 }
1391 1396
1392 // now, block type ("Single", "Multiple", or "Variable") 1397 // now, block type ("Single", "Multiple", or "Variable")
1393 if (fscanf(messagefilep, formatString, token) == EOF) 1398 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1394 { 1399 {
1395 // oops, file ended 1400 // oops, file ended
1396 llerrs << "Expected block type, but file ended." << llendl; 1401 llerrs << "Expected block type, but file ended." << llendl;
@@ -1415,7 +1420,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1415 else if (!strcmp(token, "Multiple")) 1420 else if (!strcmp(token, "Multiple"))
1416 { 1421 {
1417 // need to get the number of repeats 1422 // need to get the number of repeats
1418 if (fscanf(messagefilep, formatString, token) == EOF) 1423 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1419 { 1424 {
1420 // oops, file ended 1425 // oops, file ended
1421 llerrs << "Expected block multiple count," 1426 llerrs << "Expected block multiple count,"
@@ -1471,7 +1476,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1471 // ok, need to pull header info 1476 // ok, need to pull header info
1472 1477
1473 // name first 1478 // name first
1474 if (fscanf(messagefilep, formatString, var_name) == EOF) 1479 if (fscanf(messagefilep, formatString, var_name) == EOF) /* Flawfinder: ignore */
1475 { 1480 {
1476 // oops, file ended 1481 // oops, file ended
1477 llerrs << "Expected variable name, but file ended." 1482 llerrs << "Expected variable name, but file ended."
@@ -1500,7 +1505,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1500 } 1505 }
1501 1506
1502 // now, variable type ("Fixed" or "Variable") 1507 // now, variable type ("Fixed" or "Variable")
1503 if (fscanf(messagefilep, formatString, token) == EOF) 1508 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1504 { 1509 {
1505 // oops, file ended 1510 // oops, file ended
1506 llerrs << "Expected variable type, but file ended" 1511 llerrs << "Expected variable type, but file ended"
@@ -1594,7 +1599,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1594 else if (!strcmp(token, "Fixed")) 1599 else if (!strcmp(token, "Fixed"))
1595 { 1600 {
1596 // need to get the variable size 1601 // need to get the variable size
1597 if (fscanf(messagefilep, formatString, token) == EOF) 1602 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1598 { 1603 {
1599 // oops, file ended 1604 // oops, file ended
1600 llerrs << "Expected variable size, but file ended" 1605 llerrs << "Expected variable size, but file ended"
@@ -1627,7 +1632,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1627 else if (!strcmp(token, "Variable")) 1632 else if (!strcmp(token, "Variable"))
1628 { 1633 {
1629 // need to get the variable size 1634 // need to get the variable size
1630 if (fscanf(messagefilep, formatString, token) == EOF) 1635 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1631 { 1636 {
1632 // oops, file ended 1637 // oops, file ended
1633 llerrs << "Expected variable size, but file ended" 1638 llerrs << "Expected variable size, but file ended"
@@ -1676,7 +1681,7 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
1676 if (!strcmp(token, "version")) 1681 if (!strcmp(token, "version"))
1677 { 1682 {
1678 // version number 1683 // version number
1679 if (fscanf(messagefilep, formatString, token) == EOF) 1684 if (fscanf(messagefilep, formatString, token) == EOF) /* Flawfinder: ignore */
1680 { 1685 {
1681 // oops, file ended 1686 // oops, file ended
1682 llerrs << "Expected version number, but file ended" 1687 llerrs << "Expected version number, but file ended"
@@ -1815,14 +1820,27 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
1815 else 1820 else
1816 { 1821 {
1817 LLHost host; 1822 LLHost host;
1818 LLCircuitData *cdp; 1823 LLCircuitData* cdp;
1819 1824
1820 // note if packet acks are appended. 1825 // note if packet acks are appended.
1821 if(buffer[0] & LL_ACK_FLAG) 1826 if(buffer[0] & LL_ACK_FLAG)
1822 { 1827 {
1823 acks += buffer[--mReceiveSize]; 1828 acks += buffer[--mReceiveSize];
1824 true_rcv_size = mReceiveSize; 1829 true_rcv_size = mReceiveSize;
1825 mReceiveSize -= acks * sizeof(TPACKETID); 1830 if(mReceiveSize >= ((S32)(acks * sizeof(TPACKETID) + LL_MINIMUM_VALID_PACKET_SIZE)))
1831 {
1832 mReceiveSize -= acks * sizeof(TPACKETID);
1833 }
1834 else
1835 {
1836 // mal-formed packet. ignore it and continue with
1837 // the next one
1838 llwarns << "Malformed packet received. Packet size "
1839 << mReceiveSize << " with invalid no. of acks " << acks
1840 << llendl;
1841 valid_packet = FALSE;
1842 continue;
1843 }
1826 } 1844 }
1827 1845
1828 // process the message as normal 1846 // process the message as normal
@@ -2734,7 +2752,7 @@ void LLMessageSystem::buildMessage()
2734 temp_block_number = (U8)mbci->mBlockNumber; 2752 temp_block_number = (U8)mbci->mBlockNumber;
2735 if ((S32)(mSendSize + sizeof(U8)) < MAX_BUFFER_SIZE) 2753 if ((S32)(mSendSize + sizeof(U8)) < MAX_BUFFER_SIZE)
2736 { 2754 {
2737 memcpy(&mSendBuffer[mSendSize], &temp_block_number, sizeof(U8)); 2755 memcpy(&mSendBuffer[mSendSize], &temp_block_number, sizeof(U8)); /* Flawfinder: ignore */
2738 mSendSize += sizeof(U8); 2756 mSendSize += sizeof(U8);
2739 } 2757 }
2740 else 2758 else
@@ -2811,7 +2829,7 @@ void LLMessageSystem::buildMessage()
2811 { 2829 {
2812 if(mSendSize + mvci.getSize() < (S32)sizeof(mSendBuffer)) 2830 if(mSendSize + mvci.getSize() < (S32)sizeof(mSendBuffer))
2813 { 2831 {
2814 memcpy( 2832 memcpy( /* Flawfinder: ignore */
2815 &mSendBuffer[mSendSize], 2833 &mSendBuffer[mSendSize],
2816 mvci.getData(), 2834 mvci.getData(),
2817 mvci.getSize()); 2835 mvci.getSize());
@@ -3077,7 +3095,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
3077 3095
3078 if((S32)(buffer_length + sizeof(TPACKETID)) < MAX_BUFFER_SIZE) 3096 if((S32)(buffer_length + sizeof(TPACKETID)) < MAX_BUFFER_SIZE)
3079 { 3097 {
3080 memcpy(&buf_ptr[buffer_length], &packet_id, sizeof(TPACKETID)); 3098 memcpy(&buf_ptr[buffer_length], &packet_id, sizeof(TPACKETID)); /* Flawfinder: ignore */
3081 // Do the accounting 3099 // Do the accounting
3082 buffer_length += sizeof(TPACKETID); 3100 buffer_length += sizeof(TPACKETID);
3083 } 3101 }
@@ -3185,7 +3203,7 @@ BOOL LLMessageSystem::decodeTemplate(
3185 // it appears that if there is a NULL in the message #, it won't copy it.... 3203 // it appears that if there is a NULL in the message #, it won't copy it....
3186 // what was the goal? 3204 // what was the goal?
3187 //if(header[2]) 3205 //if(header[2])
3188 memcpy(&message_id_U16, &header[2], 2); 3206 memcpy(&message_id_U16, &header[2], 2); /* Flawfinder: ignore */
3189 3207
3190 // dependant on endian-ness: 3208 // dependant on endian-ness:
3191 // U32 temp = (255 << 24) | (255 << 16) | header[2]; 3209 // U32 temp = (255 << 24) | (255 << 16) | header[2];
@@ -3343,7 +3361,7 @@ BOOL LLMessageSystem::decodeData(const U8* buffer, const LLHost& sender )
3343 3361
3344 // create base working data set 3362 // create base working data set
3345 mCurrentRMessageData = new LLMsgData(mCurrentRMessageTemplate->mName); 3363 mCurrentRMessageData = new LLMsgData(mCurrentRMessageTemplate->mName);
3346 3364
3347 // loop through the template building the data structure as we go 3365 // loop through the template building the data structure as we go
3348 for (LLMessageTemplate::message_block_map_t::iterator iter = mCurrentRMessageTemplate->mMemberBlocks.begin(); 3366 for (LLMessageTemplate::message_block_map_t::iterator iter = mCurrentRMessageTemplate->mMemberBlocks.begin();
3349 iter != mCurrentRMessageTemplate->mMemberBlocks.end(); iter++) 3367 iter != mCurrentRMessageTemplate->mMemberBlocks.end(); iter++)
@@ -3596,7 +3614,7 @@ void LLMessageSystem::getDataFast(const char *blockname, const char *varname, vo
3596 ((U32*)datap)[1] = ((U32*)vardata.getData())[1]; 3614 ((U32*)datap)[1] = ((U32*)vardata.getData())[1];
3597 break; 3615 break;
3598 default: 3616 default:
3599 memcpy(datap, vardata.getData(), vardata_size); 3617 memcpy(datap, vardata.getData(), vardata_size); /* Flawfinder: ignore */
3600 break; 3618 break;
3601 } 3619 }
3602 } 3620 }
@@ -3608,7 +3626,7 @@ void LLMessageSystem::getDataFast(const char *blockname, const char *varname, vo
3608 << " but truncated to max size of " << max_size 3626 << " but truncated to max size of " << max_size
3609 << llendl; 3627 << llendl;
3610 3628
3611 memcpy(datap, vardata.getData(), max_size); 3629 memcpy(datap, vardata.getData(), max_size); /* Flawfinder: ignore */
3612 } 3630 }
3613} 3631}
3614 3632
@@ -4403,33 +4421,6 @@ void process_secured_template_checksum_request(LLMessageSystem* msg, void**)
4403 send_template_reply(msg, token); 4421 send_template_reply(msg, token);
4404} 4422}
4405 4423
4406void process_log_control(LLMessageSystem* msg, void**)
4407{
4408 U8 level;
4409 U32 mask;
4410 BOOL time;
4411 BOOL location;
4412 BOOL remote_infos;
4413
4414 msg->getU8Fast(_PREHASH_Options, _PREHASH_Level, level);
4415 msg->getU32Fast(_PREHASH_Options, _PREHASH_Mask, mask);
4416 msg->getBOOLFast(_PREHASH_Options, _PREHASH_Time, time);
4417 msg->getBOOLFast(_PREHASH_Options, _PREHASH_Location, location);
4418 msg->getBOOLFast(_PREHASH_Options, _PREHASH_RemoteInfos, remote_infos);
4419
4420 gErrorStream.setLevel(LLErrorStream::ELevel(level));
4421 gErrorStream.setDebugMask(mask);
4422 gErrorStream.setTime(time);
4423 gErrorStream.setPrintLocation(location);
4424 gErrorStream.setElevatedRemote(remote_infos);
4425
4426 llinfos << "Logging set to level " << gErrorStream.getLevel()
4427 << " mask " << std::hex << gErrorStream.getDebugMask() << std::dec
4428 << " time " << gErrorStream.getTime()
4429 << " loc " << gErrorStream.getPrintLocation()
4430 << llendl;
4431}
4432
4433void process_log_messages(LLMessageSystem* msg, void**) 4424void process_log_messages(LLMessageSystem* msg, void**)
4434{ 4425{
4435 U8 log_message; 4426 U8 log_message;
@@ -4475,7 +4466,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
4475 return; 4466 return;
4476 } 4467 }
4477 4468
4478 char their_digest[MD5HEX_STR_SIZE]; 4469 char their_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
4479 S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest); 4470 S32 size = msg->getSizeFast(_PREHASH_DataBlock, _PREHASH_Digest);
4480 if(size != MD5HEX_STR_BYTES) 4471 if(size != MD5HEX_STR_BYTES)
4481 { 4472 {
@@ -4555,7 +4546,7 @@ void encrypt_template(const char *src_name, const char *dest_name)
4555BOOL decrypt_template(const char *src_name, const char *dest_name) 4546BOOL decrypt_template(const char *src_name, const char *dest_name)
4556{ 4547{
4557 S32 buf_length = LL_ENCRYPT_BUF_LENGTH; 4548 S32 buf_length = LL_ENCRYPT_BUF_LENGTH;
4558 char buf[LL_ENCRYPT_BUF_LENGTH]; 4549 char buf[LL_ENCRYPT_BUF_LENGTH]; /* Flawfinder: ignore */
4559 4550
4560 FILE* infp = NULL; 4551 FILE* infp = NULL;
4561 FILE* outfp = NULL; 4552 FILE* outfp = NULL;
@@ -4570,7 +4561,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
4570 goto exit; 4561 goto exit;
4571 } 4562 }
4572 4563
4573 infp = LLFile::fopen(src_name,"rb"); 4564 infp = LLFile::fopen(src_name,"rb"); /* Flawfinder: ignore */
4574 if (!infp) 4565 if (!infp)
4575 { 4566 {
4576 llwarns << "could not open " << src_name << " for reading" << llendl; 4567 llwarns << "could not open " << src_name << " for reading" << llendl;
@@ -4583,7 +4574,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
4583 goto exit; 4574 goto exit;
4584 } 4575 }
4585 4576
4586 outfp = LLFile::fopen(dest_name,"w+b"); 4577 outfp = LLFile::fopen(dest_name,"w+b"); /* Flawfinder: ignore */
4587 if (!outfp) 4578 if (!outfp)
4588 { 4579 {
4589 llwarns << "could not open " << src_name << " for writing" << llendl; 4580 llwarns << "could not open " << src_name << " for writing" << llendl;
@@ -4618,7 +4609,7 @@ BOOL decrypt_template(const char *src_name, const char *dest_name)
4618void dump_prehash_files() 4609void dump_prehash_files()
4619{ 4610{
4620 U32 i; 4611 U32 i;
4621 FILE *fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); 4612 FILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */
4622 if (fp) 4613 if (fp)
4623 { 4614 {
4624 fprintf( 4615 fprintf(
@@ -4650,7 +4641,7 @@ void dump_prehash_files()
4650 fprintf(fp, "\n\n#endif\n"); 4641 fprintf(fp, "\n\n#endif\n");
4651 fclose(fp); 4642 fclose(fp);
4652 } 4643 }
4653 fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); 4644 fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */
4654 if (fp) 4645 if (fp)
4655 { 4646 {
4656 fprintf( 4647 fprintf(
@@ -4750,7 +4741,6 @@ BOOL start_messaging_system(
4750 gMessageSystem->setHandlerFuncFast(_PREHASH_PacketAck, process_packet_ack, NULL); 4741 gMessageSystem->setHandlerFuncFast(_PREHASH_PacketAck, process_packet_ack, NULL);
4751 gMessageSystem->setHandlerFuncFast(_PREHASH_TemplateChecksumRequest, process_template_checksum_request, NULL); 4742 gMessageSystem->setHandlerFuncFast(_PREHASH_TemplateChecksumRequest, process_template_checksum_request, NULL);
4752 gMessageSystem->setHandlerFuncFast(_PREHASH_SecuredTemplateChecksumRequest, process_secured_template_checksum_request, NULL); 4743 gMessageSystem->setHandlerFuncFast(_PREHASH_SecuredTemplateChecksumRequest, process_secured_template_checksum_request, NULL);
4753 gMessageSystem->setHandlerFuncFast(_PREHASH_LogControl, process_log_control, NULL);
4754 gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, NULL); 4744 gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, NULL);
4755 gMessageSystem->setHandlerFuncFast(_PREHASH_CreateTrustedCircuit, 4745 gMessageSystem->setHandlerFuncFast(_PREHASH_CreateTrustedCircuit,
4756 process_create_trusted_circuit, 4746 process_create_trusted_circuit,
@@ -5565,13 +5555,21 @@ void LLMessageSystem::getUUID(const char *block, const char *var, LLUUID &u, S32
5565 getDataFast(gMessageStringTable.getString(block), gMessageStringTable.getString(var), u.mData, sizeof(u.mData), blocknum); 5555 getDataFast(gMessageStringTable.getString(block), gMessageStringTable.getString(var), u.mData, sizeof(u.mData), blocknum);
5566} 5556}
5567 5557
5568bool LLMessageSystem::generateDigestForNumberAndUUIDs(char* digest, const U32 number, const LLUUID &id1, const LLUUID &id2) const 5558bool LLMessageSystem::generateDigestForNumberAndUUIDs(
5559 char* digest,
5560 const U32 number,
5561 const LLUUID& id1,
5562 const LLUUID& id2) const
5569{ 5563{
5564 // *NOTE: This method is needlessly inefficient. Instead of
5565 // calling LLUUID::asString, it should just call
5566 // LLUUID::toString().
5567
5570 const char *colon = ":"; 5568 const char *colon = ":";
5571 char tbuf[16]; /* Flawfinder: ignore */ 5569 char tbuf[16]; /* Flawfinder: ignore */
5572 LLMD5 d; 5570 LLMD5 d;
5573 LLString id1string = id1.getString(); 5571 std::string id1string = id1.asString();
5574 LLString id2string = id2.getString(); 5572 std::string id2string = id2.asString();
5575 std::string shared_secret = get_shared_secret(); 5573 std::string shared_secret = get_shared_secret();
5576 unsigned char * secret = (unsigned char*)shared_secret.c_str(); 5574 unsigned char * secret = (unsigned char*)shared_secret.c_str();
5577 unsigned char * id1str = (unsigned char*)id1string.c_str(); 5575 unsigned char * id1str = (unsigned char*)id1string.c_str();
@@ -5581,7 +5579,7 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs(char* digest, const U32 nu
5581 5579
5582 if( secret != NULL) 5580 if( secret != NULL)
5583 { 5581 {
5584 d.update(secret, (U32)strlen((char *) secret)); 5582 d.update(secret, (U32)strlen((char *) secret)); /* Flawfinder: ignore */
5585 } 5583 }
5586 5584
5587 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ 5585 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
@@ -5592,13 +5590,13 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs(char* digest, const U32 nu
5592 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ 5590 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
5593 if( (char*) id1str != NULL) 5591 if( (char*) id1str != NULL)
5594 { 5592 {
5595 d.update(id1str, (U32)strlen((char *) id1str)); 5593 d.update(id1str, (U32)strlen((char *) id1str)); /* Flawfinder: ignore */
5596 } 5594 }
5597 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ 5595 d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */
5598 5596
5599 if( (char*) id2str != NULL) 5597 if( (char*) id2str != NULL)
5600 { 5598 {
5601 d.update(id2str, (U32)strlen((char *) id2str)); 5599 d.update(id2str, (U32)strlen((char *) id2str)); /* Flawfinder: ignore */
5602 } 5600 }
5603 5601
5604 d.finalize(); 5602 d.finalize();