From 9b4f54c826ffa4f94efa866068c9d6ecdfb4b424 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:48 -0500 Subject: Second Life viewer sources 1.13.2.15 --- linden/indra/llinventory/llinventory.cpp | 30 ++++++++++++++++++++---------- linden/indra/llinventory/lllandmark.cpp | 4 +++- linden/indra/llinventory/llpermissions.cpp | 24 ++++++++++++++---------- linden/indra/llinventory/llsaleinfo.cpp | 8 ++++++-- 4 files changed, 43 insertions(+), 23 deletions(-) (limited to 'linden/indra/llinventory') diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 1f7efb3..3235748 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp @@ -320,6 +320,8 @@ void LLInventoryObject::setType(LLAssetType::EType type) // virtual BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -358,7 +360,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %254s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); LLString::replaceChar(mName, '|', ' '); @@ -681,6 +683,8 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 // virtual BOOL LLInventoryItem::importFile(FILE* fp) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -769,7 +773,7 @@ BOOL LLInventoryItem::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %254s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); // IW: sscanf chokes and puts | in valuestr if there's no name if (valuestr[0] == '|') @@ -785,7 +789,7 @@ BOOL LLInventoryItem::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); if (valuestr[0] == '|') { @@ -875,6 +879,8 @@ BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const // virtual BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -889,7 +895,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) while(success && input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -963,7 +969,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); // IW: sscanf chokes and puts | in valuestr if there's no name if (valuestr[0] == '|') @@ -979,7 +985,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); + sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr); if (valuestr[0] == '|') { @@ -1522,6 +1528,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, // virtual BOOL LLInventoryCategory::importFile(FILE* fp) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -1531,7 +1539,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp) while(!feof(fp)) { fgets(buffer, MAX_STRING, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -1564,7 +1572,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); LLString::replaceChar(mName, '|', ' '); @@ -1597,6 +1605,8 @@ BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const // virtual BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) { + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -1606,7 +1616,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) while(input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -1639,7 +1649,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) { //strcpy(valuestr, buffer + strlen(keyword) + 3); // *NOTE: Not ANSI C, but widely supported. - sscanf(buffer, " %s %[^|]", keyword, valuestr); + sscanf(buffer, " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); LLString::replaceNonstandardASCII(mName, ' '); LLString::replaceChar(mName, '|', ' '); diff --git a/linden/indra/llinventory/lllandmark.cpp b/linden/indra/llinventory/lllandmark.cpp index bca64d1..d7dca20 100644 --- a/linden/indra/llinventory/lllandmark.cpp +++ b/linden/indra/llinventory/lllandmark.cpp @@ -138,10 +138,12 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer) } else if(version == 2) { + // *NOTE: Changing the buffer size will require changing the + // scanf call below. char region_id_str[MAX_STRING]; LLVector3 pos; cur += chars_read; - count = sscanf(cur, "region_id %s\n%n", region_id_str, &chars_read); + count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read); if(count != 1) goto error; cur += chars_read; 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/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp index 39e7a72..35dbc3e 100644 --- a/linden/indra/llinventory/llpermissions.cpp +++ b/linden/indra/llinventory/llpermissions.cpp @@ -511,6 +511,8 @@ BOOL LLPermissions::importFile(FILE *fp) init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[BUFSIZE]; char keyword[256]; char valuestr[256]; @@ -523,7 +525,7 @@ BOOL LLPermissions::importFile(FILE *fp) while (!feof(fp)) { fgets(buffer, BUFSIZE, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -571,22 +573,22 @@ BOOL LLPermissions::importFile(FILE *fp) } else if (!strcmp("creator_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mCreator.set(uuid_str); } else if (!strcmp("owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mOwner.set(uuid_str); } else if (!strcmp("last_owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mLastOwner.set(uuid_str); } else if (!strcmp("group_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mGroup.set(uuid_str); } else if (!strcmp("group_owned", keyword)) @@ -644,6 +646,8 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[BUFSIZE]; char keyword[256]; char valuestr[256]; @@ -656,7 +660,7 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %255s %255s", keyword, valuestr); if (!keyword) { continue; @@ -704,22 +708,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) } else if (!strcmp("creator_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mCreator.set(uuid_str); } else if (!strcmp("owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mOwner.set(uuid_str); } else if (!strcmp("last_owner_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mLastOwner.set(uuid_str); } else if (!strcmp("group_id", keyword)) { - sscanf(valuestr, "%s", uuid_str); + sscanf(valuestr, "%255s", uuid_str); mGroup.set(uuid_str); } else if (!strcmp("group_owned", keyword)) diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp index b82bd18..98043d1 100644 --- a/linden/indra/llinventory/llsaleinfo.cpp +++ b/linden/indra/llinventory/llsaleinfo.cpp @@ -158,6 +158,8 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) { has_perm_mask = FALSE; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -168,7 +170,7 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) while(success && (!feof(fp))) { fgets(buffer, MAX_STRING, fp); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; @@ -209,6 +211,8 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m { has_perm_mask = FALSE; + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. char buffer[MAX_STRING]; char keyword[MAX_STRING]; char valuestr[MAX_STRING]; @@ -219,7 +223,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m while(success && input_stream.good()) { input_stream.getline(buffer, MAX_STRING); - sscanf(buffer, " %s %s", keyword, valuestr); + sscanf(buffer, " %254s %254s", keyword, valuestr); if(!keyword) { continue; -- cgit v1.1