Skip to content

Commit c0b1d41

Browse files
author
Bart Roossien
committed
fix: replace strncat with strlcat for robustness
1 parent 487e5ce commit c0b1d41

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
strncpy(fname, TheGlobalData->m_baseStatsDir.str(), _MAX_PATH);
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
strncpy(fname, TheGlobalData->m_baseStatsDir.str(), _MAX_PATH);
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)