[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#583939: invalid use of strcpy causes breakage on Intel x86-64 CPUs



tags 583939 + patch
retitle 583939 invalid use of strcpy causes breakage on Intel x86-64 CPUs
thanks

On Sat, 05 Jun 2010 at 10:59:29 +0100, Sheridan Hutchinson wrote:
> You may find this thread useful.
> 
> http://www.quakelive.com/forum/showthread.php?t=38447&page=3

Thanks, that thread leads to <http://bugzilla.icculus.org/show_bug.cgi?id=4331>,
which has a patch from Andreas Bierfert (andreas.bierfert at lowlatency.de)
via Fedora's Hans de Goede, which was applied in upstream ioquake3.
I've attached it.

It also passes on the useful information that this bug is only likely to be
reproducible on Intel x86-64 CPUs (Core 2, Centrino 2, etc.), and not on
the AMD equivalents.

However, tremulous has a number of other open bugs (many of which have been
fixed either in Tremulous svn or in ioquake3) and hasn't been touched by the
Debian maintainer since 2007.

As an open-source engine (albeit with non-free art), these bugs can be fixed,
but to do so requires somewhat active maintenance. Is the current maintainer
still available? If not, would the Games Team would be interested in picking
it up?

(As well as cherry-picking fixes from upstream svn, some of the portability
patches from Debian's OpenArena package would probably also be applicable.)

I've cc'd the Games Team and the sponsor of the last couple of maintainer
uploads.

Regards,
    Simon
Author: Andreas Bierfert (andreas.bierfert at lowlatency.de)
Reviewed-by: Ludwig Nussel
Description: fix abuse of strcpy (overlapping source and dest)
Bug: http://bugzilla.icculus.org/show_bug.cgi?id=4331
Bug-Fedora: http://bugzilla.redhat.com/show_bug.cgi?id=526338 

diff --git a/src/botlib/l_precomp.c b/src/botlib/l_precomp.c
index 5a0acac..1bd1e0d 100644
--- a/src/botlib/l_precomp.c
+++ b/src/botlib/l_precomp.c
@@ -952,7 +952,7 @@ void PC_ConvertPath(char *path)
 		if ((*ptr == '\\' || *ptr == '/') &&
 				(*(ptr+1) == '\\' || *(ptr+1) == '/'))
 		{
-			strcpy(ptr, ptr+1);
+			memmove(ptr, ptr+1, strlen(ptr));
 		} //end if
 		else
 		{
diff --git a/src/botlib/l_script.c b/src/botlib/l_script.c
index 485254f..7b2e2ad 100644
--- a/src/botlib/l_script.c
+++ b/src/botlib/l_script.c
@@ -1119,7 +1119,7 @@ void StripDoubleQuotes(char *string)
 {
 	if (*string == '\"')
 	{
-		strcpy(string, string+1);
+		memmove(string, string+1, strlen(string));
 	} //end if
 	if (string[strlen(string)-1] == '\"')
 	{
@@ -1136,7 +1136,7 @@ void StripSingleQuotes(char *string)
 {
 	if (*string == '\'')
 	{
-		strcpy(string, string+1);
+		memmove(string, string+1, strlen(string));
 	} //end if
 	if (string[strlen(string)-1] == '\'')
 	{

Attachment: signature.asc
Description: Digital signature


Reply to: