Merge pull request #8343 from Robyt3/Client-Chat-History-Size-Fix

Fix size of chat history entry allocation
This commit is contained in:
Dennis Felsing 2024-05-10 12:20:44 +00:00 committed by GitHub
commit 02a4e58972
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1360,8 +1360,9 @@ void CChat::SendChatQueued(const char *pLine)
if(AddEntry)
{
CHistoryEntry *pEntry = m_History.Allocate(sizeof(CHistoryEntry) + str_length(pLine) - 1);
const int Length = str_length(pLine);
CHistoryEntry *pEntry = m_History.Allocate(sizeof(CHistoryEntry) + Length);
pEntry->m_Team = m_Mode == MODE_ALL ? 0 : 1;
mem_copy(pEntry->m_aText, pLine, str_length(pLine));
str_copy(pEntry->m_aText, pLine, Length + 1);
}
}