Increase ChangeControl text buffer to resolve buffer overflow with System Menu/GIF control config

This commit is contained in:
mazmazz 2018-12-31 01:26:25 -05:00
parent 07e7dba730
commit 91f9168a01
1 changed files with 7 additions and 4 deletions

View File

@ -8871,7 +8871,7 @@ static void M_DrawControl(void)
#undef controlheight
static INT32 controltochange;
static char controltochangetext[55];
static char controltochangetext[33];
static void M_ChangecontrolResponse(event_t *ev)
{
@ -8949,7 +8949,8 @@ static void M_ChangecontrolResponse(event_t *ev)
}
else if (ch == KEY_PAUSE)
{
static char tmp[155];
// This buffer assumes a 100-character message plus a 32-character control name (per controltochangetext buffer size)
static char tmp[133];
menu_t *prev = currentMenu->prevMenu;
if (controltochange == gc_pause)
@ -8973,12 +8974,14 @@ static void M_ChangecontrolResponse(event_t *ev)
static void M_ChangeControl(INT32 choice)
{
static char tmp[55];
// This buffer assumes a 35-character message (per below) plus a max control name limit of 32 chars (per controltochangetext)
// If you change the below message, then change the size of this buffer!
static char tmp[68];
controltochange = currentMenu->menuitems[choice].alphaKey;
sprintf(tmp, M_GetText("Hit the new key for\n%s\nESC for Cancel"),
currentMenu->menuitems[choice].text);
strncpy(controltochangetext, currentMenu->menuitems[choice].text, 55);
strlcpy(controltochangetext, currentMenu->menuitems[choice].text, 33);
M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
}