if (addtofile)
{
// add it to the iplog.txt file
+ {
+ char name[MAX_OSPATH];
+ strlcpy(name, cl_iplog_name.string, sizeof(name));
+ FS_SetExtension(name, ".log", sizeof (name), IS_HARDENED);
+ Cvar_SetQuick(cl_iplog_name, name);
+ }
// TODO: this ought to open the one in the userpath version of the base
// gamedir, not the current gamedir
Log_Printf(cl_iplog_name.string, "%s %s\n", address, name);
char line[MAX_INPUTLINE];
char address[MAX_INPUTLINE];
cl_iplog_loaded = true;
+ {
+ char name[MAX_OSPATH];
+ strlcpy(name, cl_iplog_name.string, sizeof(name));
+ FS_SetExtension(name, ".log", sizeof (name), IS_HARDENED);
+ Cvar_SetQuick(cl_iplog_name, name);
+ }
// TODO: this ought to open the one in the userpath version of the base
// gamedir, not the current gamedir
filedata = FS_LoadFile(cl_iplog_name.string, tempmempool, true, &filesize);
if (logfile != NULL || log_file.string[0] == '\0')
return;
+ {
+ char name[MAX_OSPATH];
+ strlcpy(name, log_file.string, sizeof(name));
+ FS_SetExtension(name, ".log", sizeof (name), IS_HARDENED);
+ Cvar_SetQuick(log_file, name);
+ }
+
logfile = FS_OpenRealFile(log_file.string, "a", false);
if (logfile != NULL)
{
{
int i;
qfile_t *file;
+ char name[MAX_OSPATH];
if (Cmd_Argc() != 2)
{
Con_Printf("usage: condump <filename>\n");
return;
}
- file = FS_OpenRealFile(Cmd_Argv(1), "w", false);
+ strlcpy(name, Cmd_Argv(1), sizeof(name));
+ FS_SetExtension(name, ".txt", sizeof (name), IS_HARDENED);
+ file = FS_OpenRealFile(name, "w", false);
if (!file)
{
Con_Printf("condump: unable to write file \"%s\"\n", Cmd_Argv(1));
static void Host_SaveConfig_to(const char *file)
{
qfile_t *f;
+ char name[MAX_OSPATH];
+
+ strlcpy(name, file, sizeof(name));
+ FS_SetExtension(name, ".cfg", sizeof (name), IS_HARDENED);
// dedicated servers initialize the host but don't parse and set the
// config.cfg cvars
// LordHavoc: don't save a config if it crashed in startup
if (host_framecount >= 3 && cls.state != ca_dedicated && !COM_CheckParm("-benchmark") && !COM_CheckParm("-capturedemo"))
{
- f = FS_OpenRealFile(file, "wb", false);
+ f = FS_OpenRealFile(name, "wb", false);
if (!f)
{
- Con_Printf("Couldn't write %s.\n", file);
+ Con_Printf("Couldn't write %s.\n", name);
return;
}