Enlarged some buffers to make space for multibyte characters.
Also added overflow checks. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1848 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+16
-12
@@ -130,43 +130,47 @@ enum
|
|||||||
static void
|
static void
|
||||||
FeedbackSetting (BYTE which_setting)
|
FeedbackSetting (BYTE which_setting)
|
||||||
{
|
{
|
||||||
UNICODE buf[20];
|
UNICODE buf[64];
|
||||||
char tmpstr[3];
|
const char *tmpstr;
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
switch (which_setting)
|
switch (which_setting)
|
||||||
{
|
{
|
||||||
case SOUND_ON_SETTING:
|
case SOUND_ON_SETTING:
|
||||||
case SOUND_OFF_SETTING:
|
case SOUND_OFF_SETTING:
|
||||||
wsprintf (buf, "%s %s",
|
snprintf (buf, sizeof buf, "%s %s",
|
||||||
GAME_STRING (OPTION_STRING_BASE + 0),
|
GAME_STRING (OPTION_STRING_BASE + 0),
|
||||||
GLOBAL (glob_flags) & SOUND_DISABLED
|
GLOBAL (glob_flags) & SOUND_DISABLED
|
||||||
? GAME_STRING (OPTION_STRING_BASE + 3) : GAME_STRING (OPTION_STRING_BASE + 4));
|
? GAME_STRING (OPTION_STRING_BASE + 3) :
|
||||||
|
GAME_STRING (OPTION_STRING_BASE + 4));
|
||||||
break;
|
break;
|
||||||
case MUSIC_ON_SETTING:
|
case MUSIC_ON_SETTING:
|
||||||
case MUSIC_OFF_SETTING:
|
case MUSIC_OFF_SETTING:
|
||||||
wsprintf (buf, "%s %s",
|
snprintf (buf, sizeof buf, "%s %s",
|
||||||
GAME_STRING (OPTION_STRING_BASE + 1),
|
GAME_STRING (OPTION_STRING_BASE + 1),
|
||||||
GLOBAL (glob_flags) & MUSIC_DISABLED
|
GLOBAL (glob_flags) & MUSIC_DISABLED
|
||||||
? GAME_STRING (OPTION_STRING_BASE + 3) : GAME_STRING (OPTION_STRING_BASE + 4));
|
? GAME_STRING (OPTION_STRING_BASE + 3) :
|
||||||
|
GAME_STRING (OPTION_STRING_BASE + 4));
|
||||||
break;
|
break;
|
||||||
case CYBORG_OFF_SETTING:
|
case CYBORG_OFF_SETTING:
|
||||||
case CYBORG_NORMAL_SETTING:
|
case CYBORG_NORMAL_SETTING:
|
||||||
case CYBORG_DOUBLE_SETTING:
|
case CYBORG_DOUBLE_SETTING:
|
||||||
case CYBORG_SUPER_SETTING:
|
case CYBORG_SUPER_SETTING:
|
||||||
if (optWhichMenu == OPT_PC && which_setting > CYBORG_NORMAL_SETTING)
|
if (optWhichMenu == OPT_PC &&
|
||||||
|
which_setting > CYBORG_NORMAL_SETTING)
|
||||||
{
|
{
|
||||||
if (which_setting == CYBORG_DOUBLE_SETTING)
|
if (which_setting == CYBORG_DOUBLE_SETTING)
|
||||||
strcpy (tmpstr, "+");
|
tmpstr = "+";
|
||||||
else
|
else
|
||||||
strcpy (tmpstr, "++");
|
tmpstr = "++";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmpstr[0] = 0;
|
tmpstr = "";
|
||||||
wsprintf (buf, "%s %s%s",
|
snprintf (buf, sizeof buf, "%s %s%s",
|
||||||
GAME_STRING (OPTION_STRING_BASE + 2),
|
GAME_STRING (OPTION_STRING_BASE + 2),
|
||||||
!(GLOBAL (glob_flags) & CYBORG_ENABLED)
|
!(GLOBAL (glob_flags) & CYBORG_ENABLED)
|
||||||
? GAME_STRING (OPTION_STRING_BASE + 3) : GAME_STRING (OPTION_STRING_BASE + 4),
|
? GAME_STRING (OPTION_STRING_BASE + 3) :
|
||||||
|
GAME_STRING (OPTION_STRING_BASE + 4),
|
||||||
tmpstr);
|
tmpstr);
|
||||||
break;
|
break;
|
||||||
case CHANGE_CAPTAIN_SETTING:
|
case CHANGE_CAPTAIN_SETTING:
|
||||||
|
|||||||
Reference in New Issue
Block a user