[ioquake3] 45/136: Save connect and playdemo argument before calling CL_Disconnect()
Simon McVittie
smcv at debian.org
Thu Jun 15 09:09:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit eecc8326a0b9af15976b0910d2e9bcdc925ceec6
Author: Zack Middleton <zack at cloemail.com>
Date: Wed May 24 12:30:25 2017 -0500
Save connect and playdemo argument before calling CL_Disconnect()
Save argument instead of using a pointer to cmd token memory that
might be overwritten when Cmd_TokenizeString() is called.
No known method for causing the issue without engine changes.
Cmd_TokenizeString() is called by FS_PureServerSetReferencedPaks()
in CL_Disconnect() but it's not an issue because the string is
blank.
Thanks @mickael9.
---
code/client/cl_main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 31dd9ab..e9a406e 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -1069,7 +1069,8 @@ demo <demoname>
*/
void CL_PlayDemo_f( void ) {
char name[MAX_OSPATH];
- char *arg, *ext_test;
+ char arg[MAX_OSPATH];
+ char *ext_test;
int protocol, i;
char retry[MAX_OSPATH];
@@ -1083,7 +1084,7 @@ void CL_PlayDemo_f( void ) {
Cvar_Set( "sv_killserver", "2" );
// open the demo file
- arg = Cmd_Argv(1);
+ Q_strncpyz( arg, Cmd_Argv(1), sizeof( arg ) );
CL_Disconnect( qtrue );
@@ -1690,7 +1691,7 @@ CL_Connect_f
================
*/
void CL_Connect_f( void ) {
- char *server;
+ char server[MAX_OSPATH];
const char *serverString;
int argc = Cmd_Argc();
netadrtype_t family = NA_UNSPEC;
@@ -1701,7 +1702,7 @@ void CL_Connect_f( void ) {
}
if(argc == 2)
- server = Cmd_Argv(1);
+ Q_strncpyz( server, Cmd_Argv(1), sizeof( server ) );
else
{
if(!strcmp(Cmd_Argv(1), "-4"))
@@ -1711,7 +1712,7 @@ void CL_Connect_f( void ) {
else
Com_Printf( "warning: only -4 or -6 as address type understood.\n");
- server = Cmd_Argv(2);
+ Q_strncpyz( server, Cmd_Argv(2), sizeof( server ) );
}
// save arguments for reconnect
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list