mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-23 07:30:40 +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)
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
Bstrncpy(apptitle, name, sizeof(apptitle)-1);
|
||||
apptitle[ sizeof(apptitle)-1 ] = 0;
|
||||
}
|
||||
Bstrncpyz(apptitle, name, sizeof(apptitle));
|
||||
|
||||
if (hWindow) SetWindowText(hWindow, apptitle);
|
||||
startwin_settitle(apptitle);
|
||||
|
|
|
@ -11142,9 +11142,8 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
GetTime,
|
||||
GAME_onshowosd
|
||||
);
|
||||
Bstrcpy(tempbuf, APPNAME);
|
||||
wm_setapptitle(tempbuf);
|
||||
//initprintf("sizeof(mapstate_t)=%d\n", (int32_t)sizeof(mapstate_t));
|
||||
|
||||
wm_setapptitle(APPNAME);
|
||||
|
||||
initprintf(HEAD2 " %s %s\n", s_buildRev,
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -2461,6 +2461,7 @@ LUNATIC_EXTERN void C_SetCfgName(const char *cfgname)
|
|||
{
|
||||
char temp[BMAX_PATH];
|
||||
struct Bstat st;
|
||||
|
||||
int32_t fullscreen = ud.config.ScreenMode;
|
||||
int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP;
|
||||
int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick;
|
||||
|
@ -2494,15 +2495,16 @@ LUNATIC_EXTERN void C_SetCfgName(const char *cfgname)
|
|||
return;
|
||||
}
|
||||
|
||||
// XXX
|
||||
Bstrcpy(temp, cfgname);
|
||||
// XXX: Back up 'cfgname' as it may be the global 'tempbuf'.
|
||||
Bstrncpyz(temp, cfgname, sizeof(temp));
|
||||
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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue