Make sure that we have a token when doing sscanf in llinventory.cpp and llviewerobject.cpp

Guards against opensim grids that may leave new/blank lines of sorts after their message blocks
This commit is contained in:
Inusaito Sayori
2014-08-06 23:29:23 -04:00
parent 1cd0b70055
commit a82443f271
2 changed files with 9 additions and 9 deletions

View File

@@ -178,7 +178,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
while(input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
if (sscanf(buffer, " %254s %254s", keyword, valuestr) < 1) continue;
if(0 == strcmp("{",keyword))
{
continue;
@@ -610,7 +610,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp)
buffer[0] = '\0';
}
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
if (sscanf(buffer, " %254s %254s", keyword, valuestr) < 1) continue;
if(0 == strcmp("{",keyword))
{
continue;
@@ -813,10 +813,10 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
while(success && input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf( /* Flawfinder: ignore */
if (sscanf(
buffer,
" %254s %254s",
keyword, valuestr);
keyword, valuestr) < 1) continue;
if(0 == strcmp("{",keyword))
{
continue;
@@ -1489,10 +1489,10 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp)
buffer[0] = '\0';
}
sscanf( /* Flawfinder: ignore */
if (sscanf(
buffer,
" %254s %254s",
keyword, valuestr);
keyword, valuestr) < 1) continue;
if(0 == strcmp("{",keyword))
{
continue;
@@ -1568,10 +1568,10 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
while(input_stream.good())
{
input_stream.getline(buffer, MAX_STRING);
sscanf( /* Flawfinder: ignore */
if (sscanf(
buffer,
" %254s %254s",
keyword, valuestr);
keyword, valuestr) < 1) continue;
if(0 == strcmp("{",keyword))
{
continue;

View File

@@ -2903,7 +2903,7 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)
while(ifs.good())
{
ifs.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */
if (sscanf(buffer, " %254s", keyword) < 1) continue;
if(0 == strcmp("inv_item", keyword))
{
LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem;