mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-02 20:01:23 +00:00
In C_SetCfgName, don't use unsafe string functions with unknown-length input.
git-svn-id: https://svn.eduke32.com/eduke32@4144 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b67c76f814
commit
f63510cc33
3 changed files with 12 additions and 14 deletions
|
@ -256,10 +256,7 @@ int32_t wm_ynbox(char *name, char *fmt, ...)
|
||||||
void wm_setapptitle(char *name)
|
void wm_setapptitle(char *name)
|
||||||
{
|
{
|
||||||
if (name)
|
if (name)
|
||||||
{
|
Bstrncpyz(apptitle, name, sizeof(apptitle));
|
||||||
Bstrncpy(apptitle, name, sizeof(apptitle)-1);
|
|
||||||
apptitle[ sizeof(apptitle)-1 ] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hWindow) SetWindowText(hWindow, apptitle);
|
if (hWindow) SetWindowText(hWindow, apptitle);
|
||||||
startwin_settitle(apptitle);
|
startwin_settitle(apptitle);
|
||||||
|
|
|
@ -11142,9 +11142,8 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
GetTime,
|
GetTime,
|
||||||
GAME_onshowosd
|
GAME_onshowosd
|
||||||
);
|
);
|
||||||
Bstrcpy(tempbuf, APPNAME);
|
|
||||||
wm_setapptitle(tempbuf);
|
wm_setapptitle(APPNAME);
|
||||||
//initprintf("sizeof(mapstate_t)=%d\n", (int32_t)sizeof(mapstate_t));
|
|
||||||
|
|
||||||
initprintf(HEAD2 " %s %s\n", s_buildRev,
|
initprintf(HEAD2 " %s %s\n", s_buildRev,
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -2461,6 +2461,7 @@ LUNATIC_EXTERN void C_SetCfgName(const char *cfgname)
|
||||||
{
|
{
|
||||||
char temp[BMAX_PATH];
|
char temp[BMAX_PATH];
|
||||||
struct Bstat st;
|
struct Bstat st;
|
||||||
|
|
||||||
int32_t fullscreen = ud.config.ScreenMode;
|
int32_t fullscreen = ud.config.ScreenMode;
|
||||||
int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP;
|
int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP;
|
||||||
int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick;
|
int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick;
|
||||||
|
@ -2494,15 +2495,16 @@ LUNATIC_EXTERN void C_SetCfgName(const char *cfgname)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX
|
// XXX: Back up 'cfgname' as it may be the global 'tempbuf'.
|
||||||
Bstrcpy(temp, cfgname);
|
Bstrncpyz(temp, cfgname, sizeof(temp));
|
||||||
CONFIG_WriteSetup(1);
|
CONFIG_WriteSetup(1);
|
||||||
if (g_modDir[0] != '/')
|
|
||||||
Bsprintf(setupfilename,"%s/",g_modDir);
|
|
||||||
else setupfilename[0] = 0;
|
|
||||||
Bstrcat(setupfilename,temp);
|
|
||||||
|
|
||||||
initprintf("Using config file \"%s\".\n",setupfilename);
|
if (g_modDir[0] != '/')
|
||||||
|
Bsnprintf(setupfilename, sizeof(setupfilename), "%s/%s", g_modDir, temp);
|
||||||
|
else
|
||||||
|
Bstrncpyz(setupfilename, temp, sizeof(setupfilename));
|
||||||
|
|
||||||
|
initprintf("Using config file \"%s\".\n", setupfilename);
|
||||||
|
|
||||||
CONFIG_ReadSetup();
|
CONFIG_ReadSetup();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue