mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-09-27 09:55:43 +00:00
Fix for sprintf buffer overflow - #268
This commit is contained in:
parent
779b86b832
commit
04cd0b4018
@ -1941,7 +1941,7 @@ Update_t CmdTraceFile (int nArgs)
|
||||
fclose( g_hTraceFile );
|
||||
g_hTraceFile = NULL;
|
||||
|
||||
sprintf( sText, "Trace stopped." );
|
||||
_snprintf( sText, sizeof(sText), "Trace stopped." );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1961,16 +1961,17 @@ Update_t CmdTraceFile (int nArgs)
|
||||
|
||||
if (g_hTraceFile)
|
||||
{
|
||||
sprintf( sText, "Trace started: %s", sFilePath );
|
||||
_snprintf( sText, sizeof(sText), "Trace started: %s", sFilePath );
|
||||
|
||||
g_bTraceHeader = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( sText, "Trace ERROR: %s", sFilePath );
|
||||
_snprintf( sText, sizeof(sText), "Trace ERROR: %s", sFilePath );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sText[sizeof(sText)-1] = 0; // _snprintf needs null if string was longer than buffer
|
||||
ConsoleBufferPush( sText );
|
||||
ConsoleBufferToDisplay();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user