From d2098c320a3bea9469660a45658d5a581c2c7e0a Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 5 Apr 2014 20:27:33 +0000 Subject: [PATCH] astub.c: clean up [']+[F] menu code, fixing one oob access w/ dyn. entries. git-svn-id: https://svn.eduke32.com/eduke32@4417 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 35 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index fdc01e25e..6b3d36da1 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -12943,8 +12943,10 @@ static void GenericSpriteSearch(void) ////////// SPECIAL FUNCTIONS MENU ////////// +#define MENU_ENTRY_SIZE 25 + static int32_t numMenuFunctions = 8; -static char *funcMenuStrings[8*3] = +static char funcMenuStrings[8*3][MENU_ENTRY_SIZE] = { "Replace invalid tiles", "Delete all spr of tile #", @@ -12961,7 +12963,7 @@ static ofstype funcMenuStatenum[8*2]; void registerMenuFunction(const char *funcname, int32_t stateidx) { - char fn[25]; + char fn[MENU_ENTRY_SIZE]; int32_t i; if (funcname == NULL) // unregister stateidx @@ -12971,16 +12973,14 @@ void registerMenuFunction(const char *funcname, int32_t stateidx) for (i=8; i 0) { printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); col--; @@ -13121,7 +13119,7 @@ static void FuncMenu(void) if (PRESSED_KEYSC(RIGHT)) { - if ((col==0 || col==1) && crowmax[col+1]>=0) + if (col < 2 && crowmax[col+1]>=0) { printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); col++; @@ -13131,7 +13129,7 @@ static void FuncMenu(void) if (row > rowmax) row = rowmax; } } -#endif + if (PRESSED_KEYSC(ENTER)) editval = 1; @@ -13365,7 +13363,6 @@ static void FuncMenu(void) } printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); - /*clearmidstatbar16();*/ showframe(1); keystatus[KEYSC_ESC] = 0;