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
This commit is contained in:
@@ -33,6 +33,7 @@ BOOLEAN SaveProblem (void);
|
|||||||
#define MAX_SAVED_GAMES 10
|
#define MAX_SAVED_GAMES 10
|
||||||
#define SUMMARY_X_OFFS 14
|
#define SUMMARY_X_OFFS 14
|
||||||
#define SUMMARY_SIDE_OFFS 7
|
#define SUMMARY_SIDE_OFFS 7
|
||||||
|
#define MAX_NAME_CHARS 15
|
||||||
|
|
||||||
static PMENU_STATE pLocMenuState;
|
static PMENU_STATE pLocMenuState;
|
||||||
|
|
||||||
@@ -340,16 +341,7 @@ DoTextEntry (PMENU_STATE pMS)
|
|||||||
right = TRUE;
|
right = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* This really should use isprint, but for some
|
if (isprint (ch) && (len + (pStr - pBaseStr) < MAX_NAME_CHARS))
|
||||||
* 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))
|
|
||||||
{
|
{
|
||||||
memmove (pStr + 1, pStr, (len + 1) * sizeof (*pStr));
|
memmove (pStr + 1, pStr, (len + 1) * sizeof (*pStr));
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user