[iortcw] 68/95: All: Save connect and playdemo argument before calling CL_Disconnect()

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit 5ba4e034dc02719b7d5f8e2004ddd65e554942d3
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Thu May 25 11:25:05 2017 -0400

    All: Save connect and playdemo argument before calling CL_Disconnect()
---
 MP/code/client/cl_main.c | 15 ++++++++-------
 SP/code/client/cl_main.c | 15 ++++++++-------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/MP/code/client/cl_main.c b/MP/code/client/cl_main.c
index 92675c5..d479de4 100644
--- a/MP/code/client/cl_main.c
+++ b/MP/code/client/cl_main.c
@@ -1097,8 +1097,9 @@ demo <demoname>
 */
 void CL_PlayDemo_f( void ) {
 	char		name[MAX_OSPATH];
-	char		*arg, *ext_test;
-	int			protocol, i;
+	char		arg[MAX_OSPATH];
+	char		*ext_test;
+	int		protocol, i;
 	char		retry[MAX_OSPATH];
 
 	if (Cmd_Argc() != 2) {
@@ -1111,8 +1112,8 @@ 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 );
 
 	// check for an extension .DEMOEXT_?? (?? is protocol)
@@ -1787,7 +1788,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;
@@ -1798,7 +1799,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"))
@@ -1808,7 +1809,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
diff --git a/SP/code/client/cl_main.c b/SP/code/client/cl_main.c
index 18c16aa..93bd387 100644
--- a/SP/code/client/cl_main.c
+++ b/SP/code/client/cl_main.c
@@ -1082,8 +1082,9 @@ demo <demoname>
 */
 void CL_PlayDemo_f( void ) {
 	char		name[MAX_OSPATH];
-	char		*arg, *ext_test;
-	int			protocol, i;
+	char		arg[MAX_OSPATH];
+	char		*ext_test;
+	int		protocol, i;
 	char		retry[MAX_OSPATH];
 
 	if (Cmd_Argc() != 2) {
@@ -1096,8 +1097,8 @@ 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 );
 
 	// check for an extension .DEMOEXT_?? (?? is protocol)
@@ -1709,7 +1710,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;
@@ -1720,7 +1721,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"))
@@ -1730,7 +1731,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/iortcw.git



More information about the Pkg-games-commits mailing list