[iortcw] 90/497: All: Fix CL_GetTag QVM tagname buffer length

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:31 UTC 2017


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

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 5027afaebd481a516c4e2a2269f7d50c1d5585cb
Author: ZTurtleMan at gmail.com <ZTurtleMan at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Sun Apr 27 05:27:37 2014 +0000

    All: Fix CL_GetTag QVM tagname buffer length
---
 MP/code/client/cl_cgame.c | 7 +++++--
 SP/code/client/cl_cgame.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/MP/code/client/cl_cgame.c b/MP/code/client/cl_cgame.c
index 37a2484..6a1f8b7 100644
--- a/MP/code/client/cl_cgame.c
+++ b/MP/code/client/cl_cgame.c
@@ -1406,10 +1406,13 @@ qboolean CL_GetTag( int clientNum, char *tagname, orientation_t *or ) {
 		qboolean foundTag;
 		unsigned cgOr;
 		unsigned cgTagname;
+		int tagnameSize;
+
+		tagnameSize = strlen( tagname ) + 1;
 
 		// alloc data on cgame hunk and copy data to it
 		cgOr = VM_GetTempMemory( cgvm, sizeof (orientation_t), or );
-		cgTagname = VM_GetTempMemory( cgvm, MAX_QPATH, tagname );
+		cgTagname = VM_GetTempMemory( cgvm, tagnameSize, tagname );
 
 		if ( !cgOr || !cgTagname ) {
 			Com_Printf("WARNING: CL_GetTag: Not enough cgame QVM memory (increase vm_minQvmHunkMegs cvar).\n");
@@ -1420,7 +1423,7 @@ qboolean CL_GetTag( int clientNum, char *tagname, orientation_t *or ) {
 
 		// copy result back to game memory and free temp in reverse order
 		// tagname isn't copied back because it might be a static string.
-		VM_FreeTempMemory( cgvm, cgTagname, MAX_QPATH, NULL );
+		VM_FreeTempMemory( cgvm, cgTagname, tagnameSize, NULL );
 		VM_FreeTempMemory( cgvm, cgOr, sizeof (orientation_t), or );
 
 		return foundTag;
diff --git a/SP/code/client/cl_cgame.c b/SP/code/client/cl_cgame.c
index 6eb4c98..f9db9b5 100644
--- a/SP/code/client/cl_cgame.c
+++ b/SP/code/client/cl_cgame.c
@@ -1340,10 +1340,13 @@ qboolean CL_GetTag( int clientNum, char *tagname, orientation_t *or ) {
 		qboolean foundTag;
 		unsigned cgOr;
 		unsigned cgTagname;
+		int tagnameSize;
+
+		tagnameSize = strlen( tagname ) + 1;
 
 		// alloc data on cgame hunk and copy data to it
 		cgOr = VM_GetTempMemory( cgvm, sizeof (orientation_t), or );
-		cgTagname = VM_GetTempMemory( cgvm, MAX_QPATH, tagname );
+		cgTagname = VM_GetTempMemory( cgvm, tagnameSize, tagname );
 
 		if ( !cgOr || !cgTagname ) {
 			Com_Printf("WARNING: CL_GetTag: Not enough cgame QVM memory (increase vm_minQvmHunkMegs cvar).\n");
@@ -1354,7 +1357,7 @@ qboolean CL_GetTag( int clientNum, char *tagname, orientation_t *or ) {
 
 		// copy result back to game memory and free temp in reverse order
 		// tagname isn't copied back because it might be a static string.
-		VM_FreeTempMemory( cgvm, cgTagname, MAX_QPATH, NULL );
+		VM_FreeTempMemory( cgvm, cgTagname, tagnameSize, NULL );
 		VM_FreeTempMemory( cgvm, cgOr, sizeof (orientation_t), or );
 
 		return foundTag;

-- 
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