From 862a0001fcc60475e9063633d9310b60611c7735 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sun, 29 Jun 2003 20:36:58 +0000 Subject: [PATCH] Fixed a buffer overflow in the name entry; fixes #377 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1001 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/gameopt.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index 03c5e3a10..36f4a9858 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -33,6 +33,7 @@ BOOLEAN SaveProblem (void); #define MAX_SAVED_GAMES 10 #define SUMMARY_X_OFFS 14 #define SUMMARY_SIDE_OFFS 7 +#define MAX_NAME_CHARS 15 static PMENU_STATE pLocMenuState; @@ -340,16 +341,7 @@ DoTextEntry (PMENU_STATE pMS) right = TRUE; break; default: - /* This really should use isprint, but for some - * ungodly reason some machines refuse to accept - * anything as printable */ - if (!isascii (ch)) { - fprintf (stderr, "%d is not ascii, it says.\n", ch); - } - if (!isprint (ch)) { - fprintf (stderr, "%d is not printable, it says.\n", ch); - } - if (isprint (ch) && (len + (pStr - pBaseStr) < MAX_DESC_CHARS)) + if (isprint (ch) && (len + (pStr - pBaseStr) < MAX_NAME_CHARS)) { memmove (pStr + 1, pStr, (len + 1) * sizeof (*pStr)); if (len == 0)