Skip to content

Commit 9329be2

Browse files
committed
Safer status line update using snprintf
1 parent d5c8295 commit 9329be2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Vcc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ static unsigned char AutoStart=1;
6969
static unsigned char Qflag=0;
7070
static char CpuName[20]="CPUNAME";
7171

72-
char ttbuff[256];
7372
char QuickLoadFile[256];
7473
/***Forward declarations of functions included in this code module*****/
7574
BOOL InitInstance (HINSTANCE, int);
@@ -679,8 +678,11 @@ unsigned __stdcall EmuLoop(void *Dummy)
679678
EndRender(EmuState.FrameSkip);
680679
FPS/=EmuState.FrameSkip;
681680
GetModuleStatus(&EmuState);
682-
sprintf(ttbuff,"Skip:%2.2i | FPS:%3.0f | %s @ %2.2fMhz| %s",EmuState.FrameSkip,FPS,CpuName,EmuState.CPUCurrentSpeed,EmuState.StatusLine);
681+
682+
static char ttbuff[256];
683+
snprintf(ttbuff, sizeof(ttbuff), "Skip:%2.2i | FPS:%3.0f | %s @ %2.2fMhz| %s",EmuState.FrameSkip,FPS,CpuName,EmuState.CPUCurrentSpeed,EmuState.StatusLine);
683684
SetStatusBarText(ttbuff,&EmuState);
685+
684686
if (Throttle ) //Do nothing untill the frame is over returning unused time to OS
685687
FrameWait();
686688
} //Still Emulating

0 commit comments

Comments
 (0)