Skip to content

Commit 5ec40bc

Browse files
committed
Add null terminator to entry.m_name in CRenderWareSA::ClothesAddFile
1 parent b14cfbf commit 5ec40bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Client/game_sa/CRenderWareSA.ClothesReplacing.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ bool CRenderWareSA::ClothesAddFile(const char* fileData, std::size_t fileSize, c
146146

147147
DirectoryInfoSA entry{};
148148
entry.m_streamingSize = GetSizeInBlocks(fileSize);
149-
std::strncpy(entry.m_name, fileName, sizeof(entry.m_name));
149+
150+
std::size_t nameSize = sizeof(entry.m_name) - 1;
151+
std::strncpy(entry.m_name, fileName, nameSize);
152+
entry.m_name[nameSize] = '\0';
150153

151154
if (!g_clothesDirectory->AddEntry(entry))
152155
return false;

0 commit comments

Comments
 (0)