aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llinventory')
-rw-r--r--linden/indra/llinventory/llinventory.cpp194
-rw-r--r--linden/indra/llinventory/llinventory.h7
-rw-r--r--linden/indra/llinventory/llinventory_vc8.vcproj336
-rw-r--r--linden/indra/llinventory/lllandmark.cpp7
-rw-r--r--linden/indra/llinventory/llnotecard.cpp7
-rw-r--r--linden/indra/llinventory/llnotecard.h15
-rw-r--r--linden/indra/llinventory/llparcel.cpp4
-rw-r--r--linden/indra/llinventory/llpermissions.cpp67
-rw-r--r--linden/indra/llinventory/llsaleinfo.cpp22
9 files changed, 532 insertions, 127 deletions
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp
index 3235748..c5be7f7 100644
--- a/linden/indra/llinventory/llinventory.cpp
+++ b/linden/indra/llinventory/llinventory.cpp
@@ -32,7 +32,7 @@
32#include "llinventory.h" 32#include "llinventory.h"
33 33
34#include "lldbstrings.h" 34#include "lldbstrings.h"
35#include "llcrypto.h" 35#include "llxorcipher.h"
36#include "llsd.h" 36#include "llsd.h"
37#include "message.h" 37#include "message.h"
38#include <boost/tokenizer.hpp> 38#include <boost/tokenizer.hpp>
@@ -42,6 +42,24 @@
42#include "llsdutil.h" 42#include "llsdutil.h"
43 43
44///---------------------------------------------------------------------------- 44///----------------------------------------------------------------------------
45/// exported functions
46///----------------------------------------------------------------------------
47
48static const std::string INV_ITEM_ID_LABEL("item_id");
49static const std::string INV_FOLDER_ID_LABEL("folder_id");
50static const std::string INV_PARENT_ID_LABEL("parent_id");
51static const std::string INV_ASSET_TYPE_LABEL("type");
52static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
53static const std::string INV_INVENTORY_TYPE_LABEL("inv_type");
54static const std::string INV_NAME_LABEL("name");
55static const std::string INV_DESC_LABEL("desc");
56static const std::string INV_PERMISSIONS_LABEL("permissions");
57static const std::string INV_ASSET_ID_LABEL("asset_id");
58static const std::string INV_SALE_INFO_LABEL("sale_info");
59static const std::string INV_FLAGS_LABEL("flags");
60static const std::string INV_CREATION_DATE_LABEL("created_at");
61
62///----------------------------------------------------------------------------
45/// Local function declarations, constants, enums, and typedefs 63/// Local function declarations, constants, enums, and typedefs
46///---------------------------------------------------------------------------- 64///----------------------------------------------------------------------------
47 65
@@ -322,16 +340,16 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
322{ 340{
323 // *NOTE: Changing the buffer size will require changing the scanf 341 // *NOTE: Changing the buffer size will require changing the scanf
324 // calls below. 342 // calls below.
325 char buffer[MAX_STRING]; 343 char buffer[MAX_STRING]; /* Flawfinder: ignore */
326 char keyword[MAX_STRING]; 344 char keyword[MAX_STRING]; /* Flawfinder: ignore */
327 char valuestr[MAX_STRING]; 345 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
328 346
329 keyword[0] = '\0'; 347 keyword[0] = '\0';
330 valuestr[0] = '\0'; 348 valuestr[0] = '\0';
331 while(input_stream.good()) 349 while(input_stream.good())
332 { 350 {
333 input_stream.getline(buffer, MAX_STRING); 351 input_stream.getline(buffer, MAX_STRING);
334 sscanf(buffer, " %254s %254s", keyword, valuestr); 352 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
335 if(!keyword) 353 if(!keyword)
336 { 354 {
337 continue; 355 continue;
@@ -360,7 +378,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
360 { 378 {
361 //strcpy(valuestr, buffer + strlen(keyword) + 3); 379 //strcpy(valuestr, buffer + strlen(keyword) + 3);
362 // *NOTE: Not ANSI C, but widely supported. 380 // *NOTE: Not ANSI C, but widely supported.
363 sscanf(buffer, " %254s %254[^|]", keyword, valuestr); 381 sscanf( /* Flawfinder: ignore */
382 buffer,
383 " %254s %254[^|]",
384 keyword, valuestr);
364 mName.assign(valuestr); 385 mName.assign(valuestr);
365 LLString::replaceNonstandardASCII(mName, ' '); 386 LLString::replaceNonstandardASCII(mName, ' ');
366 LLString::replaceChar(mName, '|', ' '); 387 LLString::replaceChar(mName, '|', ' ');
@@ -380,7 +401,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
380// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented... 401// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented...
381BOOL LLInventoryObject::exportFile(FILE* fp, BOOL) const 402BOOL LLInventoryObject::exportFile(FILE* fp, BOOL) const
382{ 403{
383 char uuid_str[UUID_STR_LENGTH]; 404 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
384 fprintf(fp, "\tinv_object\t0\n\t{\n"); 405 fprintf(fp, "\tinv_object\t0\n\t{\n");
385 mUUID.toString(uuid_str); 406 mUUID.toString(uuid_str);
386 fprintf(fp, "\t\tobj_id\t%s\n", uuid_str); 407 fprintf(fp, "\t\tobj_id\t%s\n", uuid_str);
@@ -394,7 +415,7 @@ BOOL LLInventoryObject::exportFile(FILE* fp, BOOL) const
394 415
395BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const 416BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const
396{ 417{
397 char uuid_str[UUID_STR_LENGTH]; 418 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
398 output_stream << "\tinv_object\t0\n\t{\n"; 419 output_stream << "\tinv_object\t0\n\t{\n";
399 mUUID.toString(uuid_str); 420 mUUID.toString(uuid_str);
400 output_stream << "\t\tobj_id\t" << uuid_str << "\n"; 421 output_stream << "\t\tobj_id\t" << uuid_str << "\n";
@@ -647,12 +668,12 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
647 668
648 mSaleInfo.unpackMultiMessage(msg, block, block_num); 669 mSaleInfo.unpackMultiMessage(msg, block, block_num);
649 670
650 char name[DB_INV_ITEM_NAME_BUF_SIZE]; 671 char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */
651 msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); 672 msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num);
652 mName.assign(name); 673 mName.assign(name);
653 LLString::replaceNonstandardASCII(mName, ' '); 674 LLString::replaceNonstandardASCII(mName, ' ');
654 675
655 char desc[DB_INV_ITEM_DESC_BUF_SIZE]; 676 char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */
656 msg->getStringFast(block, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, block_num); 677 msg->getStringFast(block, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, block_num);
657 mDescription.assign(desc); 678 mDescription.assign(desc);
658 LLString::replaceNonstandardASCII(mDescription, ' '); 679 LLString::replaceNonstandardASCII(mDescription, ' ');
@@ -685,10 +706,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
685{ 706{
686 // *NOTE: Changing the buffer size will require changing the scanf 707 // *NOTE: Changing the buffer size will require changing the scanf
687 // calls below. 708 // calls below.
688 char buffer[MAX_STRING]; 709 char buffer[MAX_STRING]; /* Flawfinder: ignore */
689 char keyword[MAX_STRING]; 710 char keyword[MAX_STRING]; /* Flawfinder: ignore */
690 char valuestr[MAX_STRING]; 711 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
691 char junk[MAX_STRING]; 712 char junk[MAX_STRING]; /* Flawfinder: ignore */
692 BOOL success = TRUE; 713 BOOL success = TRUE;
693 714
694 keyword[0] = '\0'; 715 keyword[0] = '\0';
@@ -699,7 +720,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
699 while(success && (!feof(fp))) 720 while(success && (!feof(fp)))
700 { 721 {
701 fgets(buffer, MAX_STRING, fp); 722 fgets(buffer, MAX_STRING, fp);
702 sscanf(buffer, " %254s %254s", keyword, valuestr); 723 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
703 if(!keyword) 724 if(!keyword)
704 { 725 {
705 continue; 726 continue;
@@ -773,7 +794,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
773 { 794 {
774 //strcpy(valuestr, buffer + strlen(keyword) + 3); 795 //strcpy(valuestr, buffer + strlen(keyword) + 3);
775 // *NOTE: Not ANSI C, but widely supported. 796 // *NOTE: Not ANSI C, but widely supported.
776 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); 797 sscanf( /* Flawfinder: ignore */
798 buffer,
799 " %254s%254[\t]%254[^|]",
800 keyword, junk, valuestr);
777 801
778 // IW: sscanf chokes and puts | in valuestr if there's no name 802 // IW: sscanf chokes and puts | in valuestr if there's no name
779 if (valuestr[0] == '|') 803 if (valuestr[0] == '|')
@@ -789,7 +813,10 @@ BOOL LLInventoryItem::importFile(FILE* fp)
789 { 813 {
790 //strcpy(valuestr, buffer + strlen(keyword) + 3); 814 //strcpy(valuestr, buffer + strlen(keyword) + 3);
791 // *NOTE: Not ANSI C, but widely supported. 815 // *NOTE: Not ANSI C, but widely supported.
792 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); 816 sscanf( /* Flawfinder: ignore */
817 buffer,
818 " %254s%254[\t]%254[^|]",
819 keyword, junk, valuestr);
793 820
794 if (valuestr[0] == '|') 821 if (valuestr[0] == '|')
795 { 822 {
@@ -831,7 +858,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
831 858
832BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const 859BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const
833{ 860{
834 char uuid_str[UUID_STR_LENGTH]; 861 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
835 fprintf(fp, "\tinv_item\t0\n\t{\n"); 862 fprintf(fp, "\tinv_item\t0\n\t{\n");
836 mUUID.toString(uuid_str); 863 mUUID.toString(uuid_str);
837 fprintf(fp, "\t\titem_id\t%s\n", uuid_str); 864 fprintf(fp, "\t\titem_id\t%s\n", uuid_str);
@@ -881,10 +908,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
881{ 908{
882 // *NOTE: Changing the buffer size will require changing the scanf 909 // *NOTE: Changing the buffer size will require changing the scanf
883 // calls below. 910 // calls below.
884 char buffer[MAX_STRING]; 911 char buffer[MAX_STRING]; /* Flawfinder: ignore */
885 char keyword[MAX_STRING]; 912 char keyword[MAX_STRING]; /* Flawfinder: ignore */
886 char valuestr[MAX_STRING]; 913 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
887 char junk[MAX_STRING]; 914 char junk[MAX_STRING]; /* Flawfinder: ignore */
888 BOOL success = TRUE; 915 BOOL success = TRUE;
889 916
890 keyword[0] = '\0'; 917 keyword[0] = '\0';
@@ -895,7 +922,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
895 while(success && input_stream.good()) 922 while(success && input_stream.good())
896 { 923 {
897 input_stream.getline(buffer, MAX_STRING); 924 input_stream.getline(buffer, MAX_STRING);
898 sscanf(buffer, " %254s %254s", keyword, valuestr); 925 sscanf( /* Flawfinder: ignore */
926 buffer,
927 " %254s %254s",
928 keyword, valuestr);
899 if(!keyword) 929 if(!keyword)
900 { 930 {
901 continue; 931 continue;
@@ -969,7 +999,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
969 { 999 {
970 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1000 //strcpy(valuestr, buffer + strlen(keyword) + 3);
971 // *NOTE: Not ANSI C, but widely supported. 1001 // *NOTE: Not ANSI C, but widely supported.
972 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); 1002 sscanf( /* Flawfinder: ignore */
1003 buffer,
1004 " %254s%254[\t]%254[^|]",
1005 keyword, junk, valuestr);
973 1006
974 // IW: sscanf chokes and puts | in valuestr if there's no name 1007 // IW: sscanf chokes and puts | in valuestr if there's no name
975 if (valuestr[0] == '|') 1008 if (valuestr[0] == '|')
@@ -985,7 +1018,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
985 { 1018 {
986 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1019 //strcpy(valuestr, buffer + strlen(keyword) + 3);
987 // *NOTE: Not ANSI C, but widely supported. 1020 // *NOTE: Not ANSI C, but widely supported.
988 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); 1021 sscanf( /* Flawfinder: ignore */
1022 buffer,
1023 " %254s%254[\t]%254[^|]",
1024 keyword, junk, valuestr);
989 1025
990 if (valuestr[0] == '|') 1026 if (valuestr[0] == '|')
991 { 1027 {
@@ -1027,7 +1063,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
1027 1063
1028BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const 1064BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const
1029{ 1065{
1030 char uuid_str[UUID_STR_LENGTH]; 1066 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1031 output_stream << "\tinv_item\t0\n\t{\n"; 1067 output_stream << "\tinv_item\t0\n\t{\n";
1032 mUUID.toString(uuid_str); 1068 mUUID.toString(uuid_str);
1033 output_stream << "\t\titem_id\t" << uuid_str << "\n"; 1069 output_stream << "\t\titem_id\t" << uuid_str << "\n";
@@ -1064,8 +1100,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
1064 const char* inv_type_str = LLInventoryType::lookup(mInventoryType); 1100 const char* inv_type_str = LLInventoryType::lookup(mInventoryType);
1065 if(inv_type_str) 1101 if(inv_type_str)
1066 output_stream << "\t\tinv_type\t" << inv_type_str << "\n"; 1102 output_stream << "\t\tinv_type\t" << inv_type_str << "\n";
1067 char buffer[32]; 1103 char buffer[32]; /* Flawfinder: ignore */
1068 sprintf(buffer, "\t\tflags\t%08x\n", mFlags); 1104 snprintf(buffer, sizeof(buffer), "\t\tflags\t%08x\n", mFlags); /* Flawfinder: ignore */
1069 output_stream << buffer; 1105 output_stream << buffer;
1070 mSaleInfo.exportLegacyStream(output_stream); 1106 mSaleInfo.exportLegacyStream(output_stream);
1071 output_stream << "\t\tname\t" << mName.c_str() << "|\n"; 1107 output_stream << "\t\tname\t" << mName.c_str() << "|\n";
@@ -1114,24 +1150,24 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
1114{ 1150{
1115 mInventoryType = LLInventoryType::IT_NONE; 1151 mInventoryType = LLInventoryType::IT_NONE;
1116 mAssetUUID.setNull(); 1152 mAssetUUID.setNull();
1117 const char *w; 1153 std::string w;
1118 1154
1119 w = "item_id"; 1155 w = INV_ITEM_ID_LABEL;
1120 if (sd.has(w)) 1156 if (sd.has(w))
1121 { 1157 {
1122 mUUID = sd[w]; 1158 mUUID = sd[w];
1123 } 1159 }
1124 w = "parent_id"; 1160 w = INV_PARENT_ID_LABEL;
1125 if (sd.has(w)) 1161 if (sd.has(w))
1126 { 1162 {
1127 mParentUUID = sd[w]; 1163 mParentUUID = sd[w];
1128 } 1164 }
1129 w = "permissions"; 1165 w = INV_PERMISSIONS_LABEL;
1130 if (sd.has(w)) 1166 if (sd.has(w))
1131 { 1167 {
1132 mPermissions = ll_permissions_from_sd(sd[w]); 1168 mPermissions = ll_permissions_from_sd(sd[w]);
1133 } 1169 }
1134 w = "sale_info"; 1170 w = INV_SALE_INFO_LABEL;
1135 if (sd.has(w)) 1171 if (sd.has(w))
1136 { 1172 {
1137 // Sale info used to contain next owner perm. It is now in 1173 // Sale info used to contain next owner perm. It is now in
@@ -1165,40 +1201,40 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
1165 LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); 1201 LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
1166 cipher.decrypt(mAssetUUID.mData, UUID_BYTES); 1202 cipher.decrypt(mAssetUUID.mData, UUID_BYTES);
1167 } 1203 }
1168 w = "asset_id"; 1204 w = INV_ASSET_ID_LABEL;
1169 if (sd.has(w)) 1205 if (sd.has(w))
1170 { 1206 {
1171 mAssetUUID = sd[w]; 1207 mAssetUUID = sd[w];
1172 } 1208 }
1173 w = "type"; 1209 w = INV_ASSET_TYPE_LABEL;
1174 if (sd.has(w)) 1210 if (sd.has(w))
1175 { 1211 {
1176 mType = LLAssetType::lookup(sd[w].asString().c_str()); 1212 mType = LLAssetType::lookup(sd[w].asString().c_str());
1177 } 1213 }
1178 w = "inv_type"; 1214 w = INV_INVENTORY_TYPE_LABEL;
1179 if (sd.has(w)) 1215 if (sd.has(w))
1180 { 1216 {
1181 mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str()); 1217 mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str());
1182 } 1218 }
1183 w = "flags"; 1219 w = INV_FLAGS_LABEL;
1184 if (sd.has(w)) 1220 if (sd.has(w))
1185 { 1221 {
1186 mFlags = ll_U32_from_sd(sd[w]); 1222 mFlags = ll_U32_from_sd(sd[w]);
1187 } 1223 }
1188 w = "name"; 1224 w = INV_NAME_LABEL;
1189 if (sd.has(w)) 1225 if (sd.has(w))
1190 { 1226 {
1191 mName = sd[w].asString(); 1227 mName = sd[w].asString();
1192 LLString::replaceNonstandardASCII(mName, ' '); 1228 LLString::replaceNonstandardASCII(mName, ' ');
1193 LLString::replaceChar(mName, '|', ' '); 1229 LLString::replaceChar(mName, '|', ' ');
1194 } 1230 }
1195 w = "desc"; 1231 w = INV_DESC_LABEL;
1196 if (sd.has(w)) 1232 if (sd.has(w))
1197 { 1233 {
1198 mDescription = sd[w].asString(); 1234 mDescription = sd[w].asString();
1199 LLString::replaceNonstandardASCII(mDescription, ' '); 1235 LLString::replaceNonstandardASCII(mDescription, ' ');
1200 } 1236 }
1201 w = "creation_date"; 1237 w = INV_CREATION_DATE_LABEL;
1202 if (sd.has(w)) 1238 if (sd.has(w))
1203 { 1239 {
1204 mCreationDate = sd[w]; 1240 mCreationDate = sd[w];
@@ -1335,18 +1371,18 @@ S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_overri
1335 1371
1336 // describe the inventory item 1372 // describe the inventory item
1337 char* buffer = (char*) bin_bucket; 1373 char* buffer = (char*) bin_bucket;
1338 char creator_id_str[UUID_STR_LENGTH]; 1374 char creator_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1339 1375
1340 perm.getCreator().toString(creator_id_str); 1376 perm.getCreator().toString(creator_id_str);
1341 char owner_id_str[UUID_STR_LENGTH]; 1377 char owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1342 perm.getOwner().toString(owner_id_str); 1378 perm.getOwner().toString(owner_id_str);
1343 char last_owner_id_str[UUID_STR_LENGTH]; 1379 char last_owner_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1344 perm.getLastOwner().toString(last_owner_id_str); 1380 perm.getLastOwner().toString(last_owner_id_str);
1345 char group_id_str[UUID_STR_LENGTH]; 1381 char group_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1346 perm.getGroup().toString(group_id_str); 1382 perm.getGroup().toString(group_id_str);
1347 char asset_id_str[UUID_STR_LENGTH]; 1383 char asset_id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1348 getAssetUUID().toString(asset_id_str); 1384 getAssetUUID().toString(asset_id_str);
1349 S32 size = sprintf(buffer, 1385 S32 size = sprintf(buffer, /* Flawfinder: ignore */
1350 "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x", 1386 "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x",
1351 getType(), 1387 getType(),
1352 getInventoryType(), 1388 getInventoryType(),
@@ -1376,7 +1412,15 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
1376 1412
1377 // Convert the bin_bucket into a string. 1413 // Convert the bin_bucket into a string.
1378 char* item_buffer = new char[bin_bucket_size+1]; 1414 char* item_buffer = new char[bin_bucket_size+1];
1379 memcpy(item_buffer, bin_bucket, bin_bucket_size); 1415 if ((item_buffer != NULL) && (bin_bucket != NULL))
1416 {
1417 memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
1418 }
1419 else
1420 {
1421 llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
1422 return;
1423 }
1380 item_buffer[bin_bucket_size] = '\0'; 1424 item_buffer[bin_bucket_size] = '\0';
1381 std::string str(item_buffer); 1425 std::string str(item_buffer);
1382 1426
@@ -1519,7 +1563,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
1519 S8 type; 1563 S8 type;
1520 msg->getS8Fast(block, _PREHASH_Type, type, block_num); 1564 msg->getS8Fast(block, _PREHASH_Type, type, block_num);
1521 mPreferredType = static_cast<LLAssetType::EType>(type); 1565 mPreferredType = static_cast<LLAssetType::EType>(type);
1522 char name[DB_INV_ITEM_NAME_BUF_SIZE]; 1566 char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */
1523 msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num); 1567 msg->getStringFast(block, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, block_num);
1524 mName.assign(name); 1568 mName.assign(name);
1525 LLString::replaceNonstandardASCII(mName, ' '); 1569 LLString::replaceNonstandardASCII(mName, ' ');
@@ -1530,16 +1574,19 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1530{ 1574{
1531 // *NOTE: Changing the buffer size will require changing the scanf 1575 // *NOTE: Changing the buffer size will require changing the scanf
1532 // calls below. 1576 // calls below.
1533 char buffer[MAX_STRING]; 1577 char buffer[MAX_STRING]; /* Flawfinder: ignore */
1534 char keyword[MAX_STRING]; 1578 char keyword[MAX_STRING]; /* Flawfinder: ignore */
1535 char valuestr[MAX_STRING]; 1579 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
1536 1580
1537 keyword[0] = '\0'; 1581 keyword[0] = '\0';
1538 valuestr[0] = '\0'; 1582 valuestr[0] = '\0';
1539 while(!feof(fp)) 1583 while(!feof(fp))
1540 { 1584 {
1541 fgets(buffer, MAX_STRING, fp); 1585 fgets(buffer, MAX_STRING, fp);
1542 sscanf(buffer, " %254s %254s", keyword, valuestr); 1586 sscanf( /* Flawfinder: ignore */
1587 buffer,
1588 " %254s %254s",
1589 keyword, valuestr);
1543 if(!keyword) 1590 if(!keyword)
1544 { 1591 {
1545 continue; 1592 continue;
@@ -1572,7 +1619,10 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1572 { 1619 {
1573 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1620 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1574 // *NOTE: Not ANSI C, but widely supported. 1621 // *NOTE: Not ANSI C, but widely supported.
1575 sscanf(buffer, " %254s %254[^|]", keyword, valuestr); 1622 sscanf( /* Flawfinder: ignore */
1623 buffer,
1624 " %254s %254[^|]",
1625 keyword, valuestr);
1576 mName.assign(valuestr); 1626 mName.assign(valuestr);
1577 LLString::replaceNonstandardASCII(mName, ' '); 1627 LLString::replaceNonstandardASCII(mName, ' ');
1578 LLString::replaceChar(mName, '|', ' '); 1628 LLString::replaceChar(mName, '|', ' ');
@@ -1588,7 +1638,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1588 1638
1589BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const 1639BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const
1590{ 1640{
1591 char uuid_str[UUID_STR_LENGTH]; 1641 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1592 fprintf(fp, "\tinv_category\t0\n\t{\n"); 1642 fprintf(fp, "\tinv_category\t0\n\t{\n");
1593 mUUID.toString(uuid_str); 1643 mUUID.toString(uuid_str);
1594 fprintf(fp, "\t\tcat_id\t%s\n", uuid_str); 1644 fprintf(fp, "\t\tcat_id\t%s\n", uuid_str);
@@ -1607,16 +1657,19 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1607{ 1657{
1608 // *NOTE: Changing the buffer size will require changing the scanf 1658 // *NOTE: Changing the buffer size will require changing the scanf
1609 // calls below. 1659 // calls below.
1610 char buffer[MAX_STRING]; 1660 char buffer[MAX_STRING]; /* Flawfinder: ignore */
1611 char keyword[MAX_STRING]; 1661 char keyword[MAX_STRING]; /* Flawfinder: ignore */
1612 char valuestr[MAX_STRING]; 1662 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
1613 1663
1614 keyword[0] = '\0'; 1664 keyword[0] = '\0';
1615 valuestr[0] = '\0'; 1665 valuestr[0] = '\0';
1616 while(input_stream.good()) 1666 while(input_stream.good())
1617 { 1667 {
1618 input_stream.getline(buffer, MAX_STRING); 1668 input_stream.getline(buffer, MAX_STRING);
1619 sscanf(buffer, " %254s %254s", keyword, valuestr); 1669 sscanf( /* Flawfinder: ignore */
1670 buffer,
1671 " %254s %254s",
1672 keyword, valuestr);
1620 if(!keyword) 1673 if(!keyword)
1621 { 1674 {
1622 continue; 1675 continue;
@@ -1649,7 +1702,10 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1649 { 1702 {
1650 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1703 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1651 // *NOTE: Not ANSI C, but widely supported. 1704 // *NOTE: Not ANSI C, but widely supported.
1652 sscanf(buffer, " %254s %254[^|]", keyword, valuestr); 1705 sscanf( /* Flawfinder: ignore */
1706 buffer,
1707 " %254s %254[^|]",
1708 keyword, valuestr);
1653 mName.assign(valuestr); 1709 mName.assign(valuestr);
1654 LLString::replaceNonstandardASCII(mName, ' '); 1710 LLString::replaceNonstandardASCII(mName, ' ');
1655 LLString::replaceChar(mName, '|', ' '); 1711 LLString::replaceChar(mName, '|', ' ');
@@ -1665,7 +1721,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1665 1721
1666BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const 1722BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const
1667{ 1723{
1668 char uuid_str[UUID_STR_LENGTH]; 1724 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */
1669 output_stream << "\tinv_category\t0\n\t{\n"; 1725 output_stream << "\tinv_category\t0\n\t{\n";
1670 mUUID.toString(uuid_str); 1726 mUUID.toString(uuid_str);
1671 output_stream << "\t\tcat_id\t" << uuid_str << "\n"; 1727 output_stream << "\t\tcat_id\t" << uuid_str << "\n";
@@ -1701,24 +1757,6 @@ bool inventory_and_asset_types_match(
1701 return rv; 1757 return rv;
1702} 1758}
1703 1759
1704///----------------------------------------------------------------------------
1705/// exported functions
1706///----------------------------------------------------------------------------
1707
1708static const std::string INV_ITEM_ID_LABEL("item_id");
1709static const std::string INV_FOLDER_ID_LABEL("folder_id");
1710static const std::string INV_PARENT_ID_LABEL("parent_id");
1711static const std::string INV_ASSET_TYPE_LABEL("asset_type");
1712static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
1713static const std::string INV_INVENTORY_TYPE_LABEL("inv_type");
1714static const std::string INV_NAME_LABEL("name");
1715static const std::string INV_DESC_LABEL("description");
1716static const std::string INV_PERMISSIONS_LABEL("permissions");
1717static const std::string INV_ASSET_ID_LABEL("asset_id");
1718static const std::string INV_SALE_INFO_LABEL("sale_info");
1719static const std::string INV_FLAGS_LABEL("flags");
1720static const std::string INV_CREATION_DATE_LABEL("created_at");
1721
1722LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item) 1760LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
1723{ 1761{
1724 LLSD rv; 1762 LLSD rv;
diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h
index 1ebcabf..fc135de 100644
--- a/linden/indra/llinventory/llinventory.h
+++ b/linden/indra/llinventory/llinventory.h
@@ -32,6 +32,7 @@
32 32
33#include "llassetstorage.h" 33#include "llassetstorage.h"
34#include "lldarray.h" 34#include "lldarray.h"
35#include "llmemtype.h"
35#include "llpermissions.h" 36#include "llpermissions.h"
36#include "llsaleinfo.h" 37#include "llsaleinfo.h"
37#include "llsd.h" 38#include "llsd.h"
@@ -382,6 +383,12 @@ struct SetItemOwnerAndGroup
382 LLPermissions perm = item->getPermissions(); 383 LLPermissions perm = item->getPermissions();
383 bool is_atomic = (LLAssetType::AT_OBJECT == item->getType()) ? false : true; 384 bool is_atomic = (LLAssetType::AT_OBJECT == item->getType()) ? false : true;
384 perm.setOwnerAndGroup(mAuthorityID, mOwnerID, mGroupID, is_atomic); 385 perm.setOwnerAndGroup(mAuthorityID, mOwnerID, mGroupID, is_atomic);
386 // If no owner id is set, this is equivalent to a deed action.
387 // Clear 'share with group'.
388 if (mOwnerID.isNull())
389 {
390 perm.setMaskGroup(PERM_NONE);
391 }
385 item->setPermissions(perm); 392 item->setPermissions(perm);
386 } 393 }
387}; 394};
diff --git a/linden/indra/llinventory/llinventory_vc8.vcproj b/linden/indra/llinventory/llinventory_vc8.vcproj
new file mode 100644
index 0000000..d66f352
--- /dev/null
+++ b/linden/indra/llinventory/llinventory_vc8.vcproj
@@ -0,0 +1,336 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8.00"
5 Name="llinventory"
6 ProjectGUID="{328D1968-924F-4863-AAE8-5F9A95BA68E5}"
7 Keyword="Win32Proj"
8 >
9 <Platforms>
10 <Platform
11 Name="Win32"
12 />
13 </Platforms>
14 <ToolFiles>
15 </ToolFiles>
16 <Configurations>
17 <Configuration
18 Name="Debug|Win32"
19 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
20 IntermediateDirectory="Debug"
21 ConfigurationType="4"
22 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
23 CharacterSet="1"
24 >
25 <Tool
26 Name="VCPreBuildEventTool"
27 />
28 <Tool
29 Name="VCCustomBuildTool"
30 />
31 <Tool
32 Name="VCXMLDataGeneratorTool"
33 />
34 <Tool
35 Name="VCWebServiceProxyGeneratorTool"
36 />
37 <Tool
38 Name="VCMIDLTool"
39 />
40 <Tool
41 Name="VCCLCompilerTool"
42 Optimization="0"
43 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\llmessage;..\llxml;..\..\libraries\i686-win32\include;..\..\libraries\include"
44 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
45 MinimalRebuild="true"
46 BasicRuntimeChecks="3"
47 RuntimeLibrary="1"
48 StructMemberAlignment="4"
49 TreatWChar_tAsBuiltInType="false"
50 ForceConformanceInForLoopScope="true"
51 UsePrecompiledHeader="0"
52 WarningLevel="3"
53 WarnAsError="true"
54 Detect64BitPortabilityProblems="false"
55 DebugInformationFormat="4"
56 />
57 <Tool
58 Name="VCManagedResourceCompilerTool"
59 />
60 <Tool
61 Name="VCResourceCompilerTool"
62 />
63 <Tool
64 Name="VCPreLinkEventTool"
65 />
66 <Tool
67 Name="VCLibrarianTool"
68 OutputFile="$(OutDir)/llinventory.lib"
69 />
70 <Tool
71 Name="VCALinkTool"
72 />
73 <Tool
74 Name="VCXDCMakeTool"
75 />
76 <Tool
77 Name="VCBscMakeTool"
78 />
79 <Tool
80 Name="VCFxCopTool"
81 />
82 <Tool
83 Name="VCPostBuildEventTool"
84 />
85 </Configuration>
86 <Configuration
87 Name="Release|Win32"
88 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
89 IntermediateDirectory="Release"
90 ConfigurationType="4"
91 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
92 CharacterSet="1"
93 >
94 <Tool
95 Name="VCPreBuildEventTool"
96 />
97 <Tool
98 Name="VCCustomBuildTool"
99 />
100 <Tool
101 Name="VCXMLDataGeneratorTool"
102 />
103 <Tool
104 Name="VCWebServiceProxyGeneratorTool"
105 />
106 <Tool
107 Name="VCMIDLTool"
108 />
109 <Tool
110 Name="VCCLCompilerTool"
111 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\llmessage;..\llxml;..\..\libraries\i686-win32\include;..\..\libraries\include"
112 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
113 RuntimeLibrary="0"
114 StructMemberAlignment="0"
115 TreatWChar_tAsBuiltInType="false"
116 ForceConformanceInForLoopScope="true"
117 UsePrecompiledHeader="0"
118 WarningLevel="3"
119 WarnAsError="true"
120 Detect64BitPortabilityProblems="false"
121 DebugInformationFormat="3"
122 />
123 <Tool
124 Name="VCManagedResourceCompilerTool"
125 />
126 <Tool
127 Name="VCResourceCompilerTool"
128 />
129 <Tool
130 Name="VCPreLinkEventTool"
131 />
132 <Tool
133 Name="VCLibrarianTool"
134 OutputFile="$(OutDir)/llinventory.lib"
135 />
136 <Tool
137 Name="VCALinkTool"
138 />
139 <Tool
140 Name="VCXDCMakeTool"
141 />
142 <Tool
143 Name="VCBscMakeTool"
144 />
145 <Tool
146 Name="VCFxCopTool"
147 />
148 <Tool
149 Name="VCPostBuildEventTool"
150 />
151 </Configuration>
152 <Configuration
153 Name="ReleaseNoOpt|Win32"
154 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
155 IntermediateDirectory="$(ConfigurationName)"
156 ConfigurationType="4"
157 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
158 CharacterSet="1"
159 >
160 <Tool
161 Name="VCPreBuildEventTool"
162 />
163 <Tool
164 Name="VCCustomBuildTool"
165 />
166 <Tool
167 Name="VCXMLDataGeneratorTool"
168 />
169 <Tool
170 Name="VCWebServiceProxyGeneratorTool"
171 />
172 <Tool
173 Name="VCMIDLTool"
174 />
175 <Tool
176 Name="VCCLCompilerTool"
177 Optimization="0"
178 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\llmessage;..\llxml;..\..\libraries\i686-win32\include;..\..\libraries\include"
179 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
180 RuntimeLibrary="0"
181 StructMemberAlignment="0"
182 TreatWChar_tAsBuiltInType="false"
183 ForceConformanceInForLoopScope="true"
184 UsePrecompiledHeader="0"
185 WarningLevel="3"
186 WarnAsError="true"
187 Detect64BitPortabilityProblems="false"
188 DebugInformationFormat="3"
189 />
190 <Tool
191 Name="VCManagedResourceCompilerTool"
192 />
193 <Tool
194 Name="VCResourceCompilerTool"
195 />
196 <Tool
197 Name="VCPreLinkEventTool"
198 />
199 <Tool
200 Name="VCLibrarianTool"
201 OutputFile="$(OutDir)/llinventory.lib"
202 />
203 <Tool
204 Name="VCALinkTool"
205 />
206 <Tool
207 Name="VCXDCMakeTool"
208 />
209 <Tool
210 Name="VCBscMakeTool"
211 />
212 <Tool
213 Name="VCFxCopTool"
214 />
215 <Tool
216 Name="VCPostBuildEventTool"
217 />
218 </Configuration>
219 </Configurations>
220 <References>
221 </References>
222 <Files>
223 <Filter
224 Name="Source Files"
225 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
226 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
227 >
228 <File
229 RelativePath=".\llcategory.cpp"
230 >
231 </File>
232 <File
233 RelativePath=".\lleconomy.cpp"
234 >
235 </File>
236 <File
237 RelativePath=".\llinventory.cpp"
238 >
239 </File>
240 <File
241 RelativePath=".\lllandmark.cpp"
242 >
243 </File>
244 <File
245 RelativePath=".\llnotecard.cpp"
246 >
247 </File>
248 <File
249 RelativePath=".\llparcel.cpp"
250 >
251 </File>
252 <File
253 RelativePath=".\llpermissions.cpp"
254 >
255 </File>
256 <File
257 RelativePath=".\llsaleinfo.cpp"
258 >
259 </File>
260 <File
261 RelativePath=".\lltransactionflags.cpp"
262 >
263 </File>
264 <File
265 RelativePath=".\lluserrelations.cpp"
266 >
267 </File>
268 </Filter>
269 <Filter
270 Name="Header Files"
271 Filter="h;hpp;hxx;hm;inl;inc;xsd"
272 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
273 >
274 <File
275 RelativePath=".\llcategory.h"
276 >
277 </File>
278 <File
279 RelativePath=".\lleconomy.h"
280 >
281 </File>
282 <File
283 RelativePath=".\llinventory.h"
284 >
285 </File>
286 <File
287 RelativePath=".\lllandmark.h"
288 >
289 </File>
290 <File
291 RelativePath=".\llnotecard.h"
292 >
293 </File>
294 <File
295 RelativePath=".\llparcel.h"
296 >
297 </File>
298 <File
299 RelativePath=".\llparcelflags.h"
300 >
301 </File>
302 <File
303 RelativePath=".\llpermissions.h"
304 >
305 </File>
306 <File
307 RelativePath=".\llpermissionsflags.h"
308 >
309 </File>
310 <File
311 RelativePath=".\llsaleinfo.h"
312 >
313 </File>
314 <File
315 RelativePath=".\lltransactionflags.h"
316 >
317 </File>
318 <File
319 RelativePath=".\lltransactiontypes.h"
320 >
321 </File>
322 <File
323 RelativePath=".\lluserrelations.h"
324 >
325 </File>
326 </Filter>
327 <Filter
328 Name="Resource Files"
329 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
330 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
331 >
332 </Filter>
333 </Files>
334 <Globals>
335 </Globals>
336</VisualStudioProject>
diff --git a/linden/indra/llinventory/lllandmark.cpp b/linden/indra/llinventory/lllandmark.cpp
index d7dca20..c153d68 100644
--- a/linden/indra/llinventory/lllandmark.cpp
+++ b/linden/indra/llinventory/lllandmark.cpp
@@ -140,10 +140,13 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer)
140 { 140 {
141 // *NOTE: Changing the buffer size will require changing the 141 // *NOTE: Changing the buffer size will require changing the
142 // scanf call below. 142 // scanf call below.
143 char region_id_str[MAX_STRING]; 143 char region_id_str[MAX_STRING]; /* Flawfinder: ignore */
144 LLVector3 pos; 144 LLVector3 pos;
145 cur += chars_read; 145 cur += chars_read;
146 count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read); 146 count = sscanf( /* Flawfinder: ignore */
147 cur,
148 "region_id %254s\n%n",
149 region_id_str, &chars_read);
147 if(count != 1) goto error; 150 if(count != 1) goto error;
148 cur += chars_read; 151 cur += chars_read;
149 count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read); 152 count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read);
diff --git a/linden/indra/llinventory/llnotecard.cpp b/linden/indra/llinventory/llnotecard.cpp
index 5f48f0e..d40cabb 100644
--- a/linden/indra/llinventory/llnotecard.cpp
+++ b/linden/indra/llinventory/llnotecard.cpp
@@ -26,11 +26,10 @@
26 */ 26 */
27 27
28#include "linden_common.h" 28#include "linden_common.h"
29#include "llinventory.h"
30#include "llnotecard.h" 29#include "llnotecard.h"
31#include "llstreamtools.h" 30#include "llstreamtools.h"
32 31
33LLNotecard::LLNotecard(U32 max_text) 32LLNotecard::LLNotecard(S32 max_text)
34: mMaxText(max_text) 33: mMaxText(max_text)
35{ 34{
36} 35}
@@ -189,7 +188,7 @@ bool LLNotecard::importStream(std::istream& str)
189 return FALSE; 188 return FALSE;
190 } 189 }
191 190
192 char line_buf[STD_STRING_BUF_SIZE]; 191 char line_buf[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */
193 str.getline(line_buf, STD_STRING_BUF_SIZE); 192 str.getline(line_buf, STD_STRING_BUF_SIZE);
194 if(str.fail()) 193 if(str.fail())
195 { 194 {
@@ -198,7 +197,7 @@ bool LLNotecard::importStream(std::istream& str)
198 } 197 }
199 line_buf[STD_STRING_STR_LEN] = '\0'; 198 line_buf[STD_STRING_STR_LEN] = '\0';
200 199
201 U32 text_len = 0; 200 S32 text_len = 0;
202 if( 1 != sscanf(line_buf, "Text length %d", &text_len) ) 201 if( 1 != sscanf(line_buf, "Text length %d", &text_len) )
203 { 202 {
204 llwarns << "Invalid Linden text length field" << llendl; 203 llwarns << "Invalid Linden text length field" << llendl;
diff --git a/linden/indra/llinventory/llnotecard.h b/linden/indra/llinventory/llnotecard.h
index 2475fd1..511d779 100644
--- a/linden/indra/llinventory/llnotecard.h
+++ b/linden/indra/llinventory/llnotecard.h
@@ -28,12 +28,21 @@
28#ifndef LL_NOTECARD_H 28#ifndef LL_NOTECARD_H
29#define LL_NOTECARD_H 29#define LL_NOTECARD_H
30 30
31const S32 MAX_NOTECARD_SIZE = 65536; 31#include "llmemory.h"
32#include "llinventory.h"
32 33
33class LLNotecard 34class LLNotecard
34{ 35{
35public: 36public:
36 LLNotecard(U32 max_text); 37 /**
38 * @brief anonymous enumeration to set max size.
39 */
40 enum
41 {
42 MAX_SIZE = 65536
43 };
44
45 LLNotecard(S32 max_text = LLNotecard::MAX_SIZE);
37 virtual ~LLNotecard(); 46 virtual ~LLNotecard();
38 47
39 bool importStream(std::istream& str); 48 bool importStream(std::istream& str);
@@ -52,7 +61,7 @@ private:
52 bool exportEmbeddedItemsStream(std::ostream& str); 61 bool exportEmbeddedItemsStream(std::ostream& str);
53 std::vector<LLPointer<LLInventoryItem> > mItems; 62 std::vector<LLPointer<LLInventoryItem> > mItems;
54 LLString mText; 63 LLString mText;
55 U32 mMaxText; 64 S32 mMaxText;
56 S32 mVersion; 65 S32 mVersion;
57 S32 mEmbeddedVersion; 66 S32 mEmbeddedVersion;
58}; 67};
diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp
index 9839e43..b4faf7c 100644
--- a/linden/indra/llinventory/llparcel.cpp
+++ b/linden/indra/llinventory/llparcel.cpp
@@ -1017,7 +1017,7 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr
1017BOOL LLParcel::exportStream(std::ostream& output_stream) 1017BOOL LLParcel::exportStream(std::ostream& output_stream)
1018{ 1018{
1019 S32 setting; 1019 S32 setting;
1020 char id_string[MAX_STRING]; 1020 char id_string[MAX_STRING]; /* Flawfinder: ignore */
1021 1021
1022 std::ios::fmtflags old_flags = output_stream.flags(); 1022 std::ios::fmtflags old_flags = output_stream.flags();
1023 output_stream.setf(std::ios::showpoint); 1023 output_stream.setf(std::ios::showpoint);
@@ -1248,7 +1248,7 @@ void LLParcel::packMessage(LLMessageSystem* msg)
1248 1248
1249void LLParcel::unpackMessage(LLMessageSystem* msg) 1249void LLParcel::unpackMessage(LLMessageSystem* msg)
1250{ 1250{
1251 char buffer[256]; 1251 char buffer[256]; /* Flawfinder: ignore */
1252 1252
1253 msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags ); 1253 msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags );
1254 msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice ); 1254 msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice );
diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp
index 35dbc3e..0788ec6 100644
--- a/linden/indra/llinventory/llpermissions.cpp
+++ b/linden/indra/llinventory/llpermissions.cpp
@@ -283,6 +283,7 @@ BOOL LLPermissions::deedToGroup(const LLUUID& agent, const LLUUID& group)
283 mOwner.setNull(); 283 mOwner.setNull();
284 } 284 }
285 mMaskBase = mMaskNextOwner; 285 mMaskBase = mMaskNextOwner;
286 mMaskGroup = PERM_NONE;
286 mGroup = group; 287 mGroup = group;
287 mIsGroupOwned = true; 288 mIsGroupOwned = true;
288 fixFairUse(); 289 fixFairUse();
@@ -506,18 +507,18 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b
506// File support 507// File support
507// 508//
508 509
509BOOL LLPermissions::importFile(FILE *fp) 510BOOL LLPermissions::importFile(FILE* fp)
510{ 511{
511 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); 512 init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
512 const S32 BUFSIZE = 16384; 513 const S32 BUFSIZE = 16384;
513 514
514 // *NOTE: Changing the buffer size will require changing the scanf 515 // *NOTE: Changing the buffer size will require changing the scanf
515 // calls below. 516 // calls below.
516 char buffer[BUFSIZE]; 517 char buffer[BUFSIZE]; /* Flawfinder: ignore */
517 char keyword[256]; 518 char keyword[256]; /* Flawfinder: ignore */
518 char valuestr[256]; 519 char valuestr[256]; /* Flawfinder: ignore */
519 char uuid_str[256]; 520 char uuid_str[256]; /* Flawfinder: ignore */
520 U32 mask; 521 U32 mask;
521 522
522 keyword[0] = '\0'; 523 keyword[0] = '\0';
523 valuestr[0] = '\0'; 524 valuestr[0] = '\0';
@@ -525,7 +526,10 @@ BOOL LLPermissions::importFile(FILE *fp)
525 while (!feof(fp)) 526 while (!feof(fp))
526 { 527 {
527 fgets(buffer, BUFSIZE, fp); 528 fgets(buffer, BUFSIZE, fp);
528 sscanf(buffer, " %255s %255s", keyword, valuestr); 529 sscanf( /* Flawfinder: ignore */
530 buffer,
531 " %255s %255s",
532 keyword, valuestr);
529 if (!keyword) 533 if (!keyword)
530 { 534 {
531 continue; 535 continue;
@@ -573,22 +577,22 @@ BOOL LLPermissions::importFile(FILE *fp)
573 } 577 }
574 else if (!strcmp("creator_id", keyword)) 578 else if (!strcmp("creator_id", keyword))
575 { 579 {
576 sscanf(valuestr, "%255s", uuid_str); 580 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
577 mCreator.set(uuid_str); 581 mCreator.set(uuid_str);
578 } 582 }
579 else if (!strcmp("owner_id", keyword)) 583 else if (!strcmp("owner_id", keyword))
580 { 584 {
581 sscanf(valuestr, "%255s", uuid_str); 585 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
582 mOwner.set(uuid_str); 586 mOwner.set(uuid_str);
583 } 587 }
584 else if (!strcmp("last_owner_id", keyword)) 588 else if (!strcmp("last_owner_id", keyword))
585 { 589 {
586 sscanf(valuestr, "%255s", uuid_str); 590 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
587 mLastOwner.set(uuid_str); 591 mLastOwner.set(uuid_str);
588 } 592 }
589 else if (!strcmp("group_id", keyword)) 593 else if (!strcmp("group_id", keyword))
590 { 594 {
591 sscanf(valuestr, "%255s", uuid_str); 595 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
592 mGroup.set(uuid_str); 596 mGroup.set(uuid_str);
593 } 597 }
594 else if (!strcmp("group_owned", keyword)) 598 else if (!strcmp("group_owned", keyword))
@@ -607,9 +611,9 @@ BOOL LLPermissions::importFile(FILE *fp)
607} 611}
608 612
609 613
610BOOL LLPermissions::exportFile(FILE *fp) const 614BOOL LLPermissions::exportFile(FILE* fp) const
611{ 615{
612 char uuid_str[256]; 616 char uuid_str[256]; /* Flawfinder: ignore */
613 617
614 fprintf(fp, "\tpermissions 0\n"); 618 fprintf(fp, "\tpermissions 0\n");
615 fprintf(fp, "\t{\n"); 619 fprintf(fp, "\t{\n");
@@ -648,11 +652,11 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
648 652
649 // *NOTE: Changing the buffer size will require changing the scanf 653 // *NOTE: Changing the buffer size will require changing the scanf
650 // calls below. 654 // calls below.
651 char buffer[BUFSIZE]; 655 char buffer[BUFSIZE]; /* Flawfinder: ignore */
652 char keyword[256]; 656 char keyword[256]; /* Flawfinder: ignore */
653 char valuestr[256]; 657 char valuestr[256]; /* Flawfinder: ignore */
654 char uuid_str[256]; 658 char uuid_str[256]; /* Flawfinder: ignore */
655 U32 mask; 659 U32 mask;
656 660
657 keyword[0] = '\0'; 661 keyword[0] = '\0';
658 valuestr[0] = '\0'; 662 valuestr[0] = '\0';
@@ -660,7 +664,10 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
660 while (input_stream.good()) 664 while (input_stream.good())
661 { 665 {
662 input_stream.getline(buffer, BUFSIZE); 666 input_stream.getline(buffer, BUFSIZE);
663 sscanf(buffer, " %255s %255s", keyword, valuestr); 667 sscanf( /* Flawfinder: ignore */
668 buffer,
669 " %255s %255s",
670 keyword, valuestr);
664 if (!keyword) 671 if (!keyword)
665 { 672 {
666 continue; 673 continue;
@@ -708,22 +715,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
708 } 715 }
709 else if (!strcmp("creator_id", keyword)) 716 else if (!strcmp("creator_id", keyword))
710 { 717 {
711 sscanf(valuestr, "%255s", uuid_str); 718 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
712 mCreator.set(uuid_str); 719 mCreator.set(uuid_str);
713 } 720 }
714 else if (!strcmp("owner_id", keyword)) 721 else if (!strcmp("owner_id", keyword))
715 { 722 {
716 sscanf(valuestr, "%255s", uuid_str); 723 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
717 mOwner.set(uuid_str); 724 mOwner.set(uuid_str);
718 } 725 }
719 else if (!strcmp("last_owner_id", keyword)) 726 else if (!strcmp("last_owner_id", keyword))
720 { 727 {
721 sscanf(valuestr, "%255s", uuid_str); 728 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
722 mLastOwner.set(uuid_str); 729 mLastOwner.set(uuid_str);
723 } 730 }
724 else if (!strcmp("group_id", keyword)) 731 else if (!strcmp("group_id", keyword))
725 { 732 {
726 sscanf(valuestr, "%255s", uuid_str); 733 sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
727 mGroup.set(uuid_str); 734 mGroup.set(uuid_str);
728 } 735 }
729 else if (!strcmp("group_owned", keyword)) 736 else if (!strcmp("group_owned", keyword))
@@ -744,21 +751,21 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
744 751
745BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const 752BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const
746{ 753{
747 char uuid_str[256]; 754 char uuid_str[256]; /* Flawfinder: ignore */
748 755
749 output_stream << "\tpermissions 0\n"; 756 output_stream << "\tpermissions 0\n";
750 output_stream << "\t{\n"; 757 output_stream << "\t{\n";
751 758
752 char buffer[256]; 759 char buffer[256]; /* Flawfinder: ignore */
753 sprintf(buffer, "\t\tbase_mask\t%08x\n", mMaskBase); 760 snprintf(buffer, sizeof(buffer), "\t\tbase_mask\t%08x\n", mMaskBase); /* Flawfinder: ignore */
754 output_stream << buffer; 761 output_stream << buffer;
755 sprintf(buffer, "\t\towner_mask\t%08x\n", mMaskOwner); 762 snprintf(buffer, sizeof(buffer), "\t\towner_mask\t%08x\n", mMaskOwner); /* Flawfinder: ignore */
756 output_stream << buffer; 763 output_stream << buffer;
757 sprintf(buffer, "\t\tgroup_mask\t%08x\n", mMaskGroup); 764 snprintf(buffer, sizeof(buffer), "\t\tgroup_mask\t%08x\n", mMaskGroup); /* Flawfinder: ignore */
758 output_stream << buffer; 765 output_stream << buffer;
759 sprintf(buffer, "\t\teveryone_mask\t%08x\n", mMaskEveryone); 766 snprintf(buffer, sizeof(buffer), "\t\teveryone_mask\t%08x\n", mMaskEveryone); /* Flawfinder: ignore */
760 output_stream << buffer; 767 output_stream << buffer;
761 sprintf(buffer, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); 768 snprintf(buffer, sizeof(buffer), "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); /* Flawfinder: ignore */
762 output_stream << buffer; 769 output_stream << buffer;
763 770
764 mCreator.toString(uuid_str); 771 mCreator.toString(uuid_str);
diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp
index 98043d1..28801e5 100644
--- a/linden/indra/llinventory/llsaleinfo.cpp
+++ b/linden/indra/llinventory/llsaleinfo.cpp
@@ -160,9 +160,9 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
160 160
161 // *NOTE: Changing the buffer size will require changing the scanf 161 // *NOTE: Changing the buffer size will require changing the scanf
162 // calls below. 162 // calls below.
163 char buffer[MAX_STRING]; 163 char buffer[MAX_STRING]; /* Flawfinder: ignore */
164 char keyword[MAX_STRING]; 164 char keyword[MAX_STRING]; /* Flawfinder: ignore */
165 char valuestr[MAX_STRING]; 165 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
166 BOOL success = TRUE; 166 BOOL success = TRUE;
167 167
168 keyword[0] = '\0'; 168 keyword[0] = '\0';
@@ -170,7 +170,10 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask)
170 while(success && (!feof(fp))) 170 while(success && (!feof(fp)))
171 { 171 {
172 fgets(buffer, MAX_STRING, fp); 172 fgets(buffer, MAX_STRING, fp);
173 sscanf(buffer, " %254s %254s", keyword, valuestr); 173 sscanf( /* Flawfinder: ignore */
174 buffer,
175 " %254s %254s",
176 keyword, valuestr);
174 if(!keyword) 177 if(!keyword)
175 { 178 {
176 continue; 179 continue;
@@ -213,9 +216,9 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
213 216
214 // *NOTE: Changing the buffer size will require changing the scanf 217 // *NOTE: Changing the buffer size will require changing the scanf
215 // calls below. 218 // calls below.
216 char buffer[MAX_STRING]; 219 char buffer[MAX_STRING]; /* Flawfinder: ignore */
217 char keyword[MAX_STRING]; 220 char keyword[MAX_STRING]; /* Flawfinder: ignore */
218 char valuestr[MAX_STRING]; 221 char valuestr[MAX_STRING]; /* Flawfinder: ignore */
219 BOOL success = TRUE; 222 BOOL success = TRUE;
220 223
221 keyword[0] = '\0'; 224 keyword[0] = '\0';
@@ -223,7 +226,10 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
223 while(success && input_stream.good()) 226 while(success && input_stream.good())
224 { 227 {
225 input_stream.getline(buffer, MAX_STRING); 228 input_stream.getline(buffer, MAX_STRING);
226 sscanf(buffer, " %254s %254s", keyword, valuestr); 229 sscanf( /* Flawfinder: ignore */
230 buffer,
231 " %254s %254s",
232 keyword, valuestr);
227 if(!keyword) 233 if(!keyword)
228 { 234 {
229 continue; 235 continue;