From 5c73f165141b30d93309d25e1324bc0170eb4da5 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 2 Aug 2010 14:26:44 +0000 Subject: Made Q_ClearStr operate in place and renamed it to COM_strclr. Removed unused Q_HightlightStr function. Changed Q_ prefix on several functions to COM_ for consistency. Clear the message string before passing it to Cmd_ExecTrigger. --- source/sv_user.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source/sv_user.c') diff --git a/source/sv_user.c b/source/sv_user.c index a8cfc67..7f7c299 100644 --- a/source/sv_user.c +++ b/source/sv_user.c @@ -572,15 +572,14 @@ static void SV_BeginDownload_f( void ) { ssize_t downloadsize, maxdownloadsize, result; int offset = 0; cvar_t *allow; - int length; + size_t len; unsigned flags; qhandle_t f; - length = Q_ClearStr( name, Cmd_Argv( 1 ), sizeof( name ) ); - Q_strlwr( name ); - - if( Cmd_Argc() > 2 ) - offset = atoi( Cmd_Argv( 2 ) ); // downloaded offset + len = Cmd_ArgvBuffer( 1, name, sizeof( name ) ); + if( len >= MAX_QPATH ) { + goto fail1; + } // hack for 'status' command if( !strcmp( name, "http" ) ) { @@ -588,11 +587,17 @@ static void SV_BeginDownload_f( void ) { return; } + len = COM_strclr( name ); + Q_strlwr( name ); + + if( Cmd_Argc() > 2 ) + offset = atoi( Cmd_Argv( 2 ) ); // downloaded offset + // hacked by zoid to allow more conrol over download // first off, no .. or global allow check if( !allow_download->integer // check for empty paths - || !length + || !len // check for illegal negative offsets || offset < 0 // don't allow anything with .. path @@ -600,7 +605,7 @@ static void SV_BeginDownload_f( void ) { // leading dots, slashes, etc are no good || !Q_ispath( name[0] ) // trailing dots, slashes, etc are no good - || !Q_ispath( name[ length - 1 ] ) + || !Q_ispath( name[ len - 1 ] ) // back slashes should be never sent || strchr( name, '\\' ) // colons are bad also -- cgit v1.2.3