summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2007-01-24 20:21:23 +0000
committerSteven Bennetts <steve@lindenlab.com>2007-01-24 20:21:23 +0000
commitad94bca0d273869d6358719f4dbd515a905acd26 (patch)
tree52ae9f056f3dd6a938434d45d5295aef87e77e0a /indra/llinventory
parent787ac69d75dbbd8ad79c32a5de54603351523eae (diff)
merge -r 56696:57082 Branch_1-13-2
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp30
-rw-r--r--indra/llinventory/lllandmark.cpp4
-rw-r--r--indra/llinventory/llpermissions.cpp24
-rw-r--r--indra/llinventory/llsaleinfo.cpp8
4 files changed, 43 insertions, 23 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index bffc4df281..cad1371247 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -301,6 +301,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];
@@ -339,7 +341,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, '|', ' ');
@@ -662,6 +664,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];
@@ -750,7 +754,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] == '|')
@@ -766,7 +770,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] == '|')
{
@@ -856,6 +860,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];
@@ -870,7 +876,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;
@@ -944,7 +950,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] == '|')
@@ -960,7 +966,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] == '|')
{
@@ -1503,6 +1509,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];
@@ -1512,7 +1520,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;
@@ -1545,7 +1553,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, '|', ' ');
@@ -1578,6 +1586,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];
@@ -1587,7 +1597,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;
@@ -1620,7 +1630,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/indra/llinventory/lllandmark.cpp b/indra/llinventory/lllandmark.cpp
index a99bd42344..00d373cf02 100644
--- a/indra/llinventory/lllandmark.cpp
+++ b/indra/llinventory/lllandmark.cpp
@@ -119,10 +119,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/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp
index 2063ac33d6..124ba4d634 100644
--- a/indra/llinventory/llpermissions.cpp
+++ b/indra/llinventory/llpermissions.cpp
@@ -492,6 +492,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];
@@ -504,7 +506,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;
@@ -552,22 +554,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))
@@ -625,6 +627,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];
@@ -637,7 +641,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;
@@ -685,22 +689,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/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp
index 7e2b293d42..2bfac4d3e7 100644
--- a/indra/llinventory/llsaleinfo.cpp
+++ b/indra/llinventory/llsaleinfo.cpp
@@ -139,6 +139,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];
@@ -149,7 +151,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;
@@ -190,6 +192,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];
@@ -200,7 +204,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;