Skip to content

Commit 9e4b82f

Browse files
authored
fix: Replace strncat with strlcat for robustness (#1677)
1 parent 47b4cdc commit 9e4b82f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Generals/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void RecorderClass::cleanUpReplayFile( void )
289289
{
290290
char fname[_MAX_PATH+1];
291291
strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname));
292-
strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname));
292+
strlcat(fname, m_fileName.str(), ARRAY_SIZE(fname));
293293
DEBUG_LOG(("Saving replay to %s", fname));
294294
AsciiString oldFname;
295295
oldFname.format("%s%s", getReplayDir().str(), m_fileName.str());

GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void RecorderClass::cleanUpReplayFile( void )
289289
{
290290
char fname[_MAX_PATH+1];
291291
strlcpy(fname, TheGlobalData->m_baseStatsDir.str(), ARRAY_SIZE(fname));
292-
strncat(fname, m_fileName.str(), _MAX_PATH - strlen(fname));
292+
strlcat(fname, m_fileName.str(), ARRAY_SIZE(fname));
293293
DEBUG_LOG(("Saving replay to %s", fname));
294294
AsciiString oldFname;
295295
oldFname.format("%s%s", getReplayDir().str(), m_fileName.str());

0 commit comments

Comments
 (0)