attempted fix for download demonum/# stuff

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2626 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2007-09-01 01:38:18 +00:00
parent 1d6fa5f0a3
commit 43a38c4639

View file

@ -1889,11 +1889,10 @@ SV_BeginDownload_f
*/ */
void SV_BeginDownload_f(void) void SV_BeginDownload_f(void)
{ {
char *name; char name[MAX_OSPATH];
extern cvar_t allow_download_anymap, allow_download_pakcontents; extern cvar_t allow_download_anymap, allow_download_pakcontents;
Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
name = Cmd_Argv(1);
if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7) if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7)
{ {
@ -1902,11 +1901,12 @@ void SV_BeginDownload_f(void)
} }
if (!strncmp(name, "demonum/", 8)) if (!strncmp(name, "demonum/", 8))
name = SV_MVDNum(atoi(name+8));
if (!name)
{ {
name = Cmd_Argv(1); // restore given name for cleaner error msg extern cvar_t sv_demoDir;
char *mvdname = SV_MVDNum(atoi(name+8));
if (!mvdname)
{
Sys_Printf ("Couldn't download %s to %s\n", name, host_client->name); Sys_Printf ("Couldn't download %s to %s\n", name, host_client->name);
if (ISNQCLIENT(host_client)) if (ISNQCLIENT(host_client))
{ {
@ -1932,6 +1932,9 @@ void SV_BeginDownload_f(void)
return; return;
} }
snprintf(name, sizeof(name), "%s/%s", sv_demoDir.string, mvdname);
}
// hacked by zoid to allow more conrol over download // hacked by zoid to allow more conrol over download
if (!SV_AllowDownload(name)) if (!SV_AllowDownload(name))
{ // don't allow anything with .. path { // don't allow anything with .. path