[ioquake3] 04/10: Few LCC memory fixes.

Simon McVittie smcv at debian.org
Sun Dec 17 18:29:07 UTC 2017


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

smcv pushed a commit to annotated tag debian/1.36+u20171216_dfsg-1
in repository ioquake3.

commit 76ec9fb6bd4c16d4d0b7978de726a9ff7cf67106
Author: David CARLIER <devnexen at gmail.com>
Date:   Sat Dec 16 00:08:23 2017 +0000

    Few LCC memory fixes.
---
 code/tools/lcc/cpp/tokens.c   | 2 +-
 code/tools/lcc/etc/bytecode.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/code/tools/lcc/cpp/tokens.c b/code/tools/lcc/cpp/tokens.c
index 3570896..964453c 100644
--- a/code/tools/lcc/cpp/tokens.c
+++ b/code/tools/lcc/cpp/tokens.c
@@ -315,7 +315,7 @@ puttokens(Tokenrow *trp)
 		if (wbp >= &wbuf[OBS]) {
 			write(1, wbuf, OBS);
 			if (wbp > &wbuf[OBS])
-				memcpy(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
+				memmove(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
 			wbp -= OBS;
 		}
 	}
diff --git a/code/tools/lcc/etc/bytecode.c b/code/tools/lcc/etc/bytecode.c
index a5855de..6e58022 100644
--- a/code/tools/lcc/etc/bytecode.c
+++ b/code/tools/lcc/etc/bytecode.c
@@ -34,8 +34,10 @@ void UpdatePaths( const char *lccBinary )
 {
 	char basepath[ 1024 ];
 	char *p;
+	size_t basepathsz = sizeof( basepath ) - 1;
 
-	strncpy( basepath, lccBinary, 1024 );
+	strncpy( basepath, lccBinary, basepathsz );
+	basepath[basepathsz] = 0;
 	p = strrchr( basepath, PATH_SEP );
 
 	if( p )

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