diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 9fa14a1d70..c91790f9c0 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -543,8 +543,11 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
return false;
}
bool purge_required = false;
-
- char buffer[MAX_STRING];
+ // FIRE-30705 protect against silly display names that cause lines to exceed max string length
+ // char buffer[MAX_STRING];
+ static constexpr int BUFFER_1K { 1024 }; // long enough to handle the most extreme Unicode nonsense and some to spare
+ char buffer[BUFFER_1K];
+ //
char conv_name_buffer[MAX_STRING];
char part_id_buffer[MAX_STRING];
char conv_id_buffer[MAX_STRING];
@@ -555,12 +558,21 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
// before CHUI-348 it was a flag of conversation voice state
int prereserved_unused;
- while (!feof(fp) && fgets(buffer, MAX_STRING, fp))
+ // FIRE-30705 protect against silly display names that cause lines to exceed max string length
+ // while (!feof(fp) && fgets(buffer, MAX_STRING, fp))
+ // {
+ // conv_name_buffer[0] = '\0';
+ // part_id_buffer[0] = '\0';
+ // conv_id_buffer[0] = '\0';
+ memset( buffer, '\0', BUFFER_1K );
+ while (!feof(fp) && fgets(buffer, BUFFER_1K, fp))
{
- conv_name_buffer[0] = '\0';
- part_id_buffer[0] = '\0';
- conv_id_buffer[0] = '\0';
-
+ // force blank for added safety
+ memset( conv_name_buffer, '\0', MAX_STRING );
+ memset( part_id_buffer, '\0', MAX_STRING );
+ memset( conv_id_buffer, '\0', MAX_STRING );
+ memset( history_file_name, '\0', MAX_STRING );
+ //
sscanf(buffer, "[%lld] %d %d %d %[^|]| %s %s %[^|]|",
&time,
&stype,
@@ -598,6 +610,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
}
mConversations.push_back(conversation);
+ memset( buffer, '\0', BUFFER_1K ); // FIRE-30705 clear buffer down
}
fclose(fp);