]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
kill some more evil
authorRudolf Polzer <divverent@xonotic.org>
Sat, 13 Jul 2013 09:30:40 +0000 (11:30 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 13 Jul 2013 09:30:40 +0000 (11:30 +0200)
cl_parse.c
console.c
host.c

index 4b8da407dde50a251f9bb95cd3d33e975c8287ba..a465f910d9708147a7cb215d5a4e550f8b3e7edc 100644 (file)
@@ -2992,6 +2992,12 @@ static void CL_IPLog_Add(const char *address, const char *name, qboolean checkex
        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);
@@ -3009,6 +3015,12 @@ static void CL_IPLog_Load(void)
        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);
index e21f2cbfb4c88abb54e51b0f49ad3a4d3a6fc390..be14fca12c9eb312b1675b1cf6679925b62179b9 100644 (file)
--- a/console.c
+++ b/console.c
@@ -410,6 +410,13 @@ static void Log_Open (void)
        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)
        {
@@ -692,12 +699,15 @@ static void Con_ConDump_f (void)
 {
        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));
diff --git a/host.c b/host.c
index 7bc799dd8b37a30a4e4c79e89b301358aec05b9b..ce6abbd1033bef683d1601a5177cd0f58292ff85 100644 (file)
--- a/host.c
+++ b/host.c
@@ -276,16 +276,20 @@ Writes key bindings and archived cvars to config.cfg
 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;
                }