r953 - in tags/1.34-rc2/code: botlib client unix
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Oct 26 11:02:33 EDT 2006
Author: ludwig
Date: 2006-10-26 11:02:33 -0400 (Thu, 26 Oct 2006)
New Revision: 953
Modified:
tags/1.34-rc2/code/botlib/l_precomp.c
tags/1.34-rc2/code/client/cl_main.c
tags/1.34-rc2/code/client/qal.c
tags/1.34-rc2/code/unix/unix_main.c
Log:
fix wrong use of strncat
Modified: tags/1.34-rc2/code/botlib/l_precomp.c
===================================================================
--- tags/1.34-rc2/code/botlib/l_precomp.c 2006-10-25 21:20:55 UTC (rev 952)
+++ tags/1.34-rc2/code/botlib/l_precomp.c 2006-10-26 15:02:33 UTC (rev 953)
@@ -469,9 +469,9 @@
strcat(token->string, "\"");
for (t = tokens; t; t = t->next)
{
- strncat(token->string, t->string, MAX_TOKEN - strlen(token->string));
+ strncat(token->string, t->string, MAX_TOKEN - strlen(token->string) - 1);
} //end for
- strncat(token->string, "\"", MAX_TOKEN - strlen(token->string));
+ strncat(token->string, "\"", MAX_TOKEN - strlen(token->string) - 1);
return qtrue;
} //end of the function PC_StringizeTokens
//============================================================================
@@ -1015,7 +1015,7 @@
break;
} //end if
if (token.type == TT_PUNCTUATION && *token.string == '>') break;
- strncat(path, token.string, MAX_PATH);
+ strncat(path, token.string, MAX_PATH - 1);
} //end while
if (*token.string != '>')
{
Modified: tags/1.34-rc2/code/client/cl_main.c
===================================================================
--- tags/1.34-rc2/code/client/cl_main.c 2006-10-25 21:20:55 UTC (rev 952)
+++ tags/1.34-rc2/code/client/cl_main.c 2006-10-26 15:02:33 UTC (rev 953)
@@ -2784,7 +2784,7 @@
Q_strncpyz( info, MSG_ReadString( msg ), MAX_INFO_STRING );
if (strlen(info)) {
if (info[strlen(info)-1] != '\n') {
- strncat(info, "\n", sizeof(info));
+ strncat(info, "\n", sizeof(info) - 1);
}
Com_Printf( "%s: %s", NET_AdrToString( from ), info );
}
Modified: tags/1.34-rc2/code/client/qal.c
===================================================================
--- tags/1.34-rc2/code/client/qal.c 2006-10-25 21:20:55 UTC (rev 952)
+++ tags/1.34-rc2/code/client/qal.c 2006-10-26 15:02:33 UTC (rev 953)
@@ -176,8 +176,8 @@
#else
char fn[1024];
getcwd(fn, sizeof(fn));
- strncat(fn, "/", sizeof(fn));
- strncat(fn, libname, sizeof(fn));
+ strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
+ strncat(fn, libname, sizeof(fn) - strlen(fn) - 1);
if( (OpenALLib = OBJLOAD(fn)) == 0 )
{
Modified: tags/1.34-rc2/code/unix/unix_main.c
===================================================================
--- tags/1.34-rc2/code/unix/unix_main.c 2006-10-25 21:20:55 UTC (rev 952)
+++ tags/1.34-rc2/code/unix/unix_main.c 2006-10-26 15:02:33 UTC (rev 953)
@@ -1236,7 +1236,7 @@
if( msg[ i ] == '\n' )
{
Com_sprintf( tempBuffer, 7, "%c[0m\n", 0x1B );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
i++;
}
else if( msg[ i ] == Q_COLOR_ESCAPE )
@@ -1258,7 +1258,7 @@
if( escapeCode )
{
Com_sprintf( tempBuffer, 7, "%c[%sm", 0x1B, escapeCode );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
}
i++;
@@ -1267,7 +1267,7 @@
else
{
Com_sprintf( tempBuffer, 7, "%c", msg[ i++ ] );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
}
}
}
More information about the quake3-commits
mailing list