summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2009-10-03 12:25:02 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:56 +0000
commit788fdf35246001ba4178dcac7665954479871f48 (patch)
treed6d61954d6a9c9380db3684a3b22a6780097e697
parent198186fb98445ef4f27e89bd7489824500ab6eec (diff)
* (bug 3416) Overlapping strings with strcpy (thanks Jacques Boscq)
* (bug 3576) Allow % since people promise it is safe (/dev/humancontroller)
-rw-r--r--src/client/cl_net_chan.c4
-rw-r--r--src/qcommon/msg.c12
-rw-r--r--src/qcommon/parse.c2
-rw-r--r--src/server/sv_net_chan.c4
4 files changed, 5 insertions, 17 deletions
diff --git a/src/client/cl_net_chan.c b/src/client/cl_net_chan.c
index ef214fe4..50b608cc 100644
--- a/src/client/cl_net_chan.c
+++ b/src/client/cl_net_chan.c
@@ -69,7 +69,7 @@ static void CL_Netchan_Encode( msg_t *msg ) {
// modify the key with the last received now acknowledged server command
if (!string[index])
index = 0;
- if (string[index] > 127 || string[index] == '%') {
+ if (string[index] > 127) {
key ^= '.' << (i & 1);
}
else {
@@ -115,7 +115,7 @@ static void CL_Netchan_Decode( msg_t *msg ) {
// modify the key with the last sent and with this message acknowledged client command
if (!string[index])
index = 0;
- if (string[index] > 127 || string[index] == '%') {
+ if (string[index] > 127) {
key ^= '.' << (i & 1);
}
else {
diff --git a/src/qcommon/msg.c b/src/qcommon/msg.c
index 837c3696..8be19aca 100644
--- a/src/qcommon/msg.c
+++ b/src/qcommon/msg.c
@@ -448,10 +448,6 @@ char *MSG_ReadString( msg_t *msg ) {
if ( c == -1 || c == 0 ) {
break;
}
- // translate all fmt spec to avoid crash bugs
- if ( c == '%' ) {
- c = '.';
- }
// don't allow higher ascii values
if ( c > 127 ) {
c = '.';
@@ -476,10 +472,6 @@ char *MSG_ReadBigString( msg_t *msg ) {
if ( c == -1 || c == 0 ) {
break;
}
- // translate all fmt spec to avoid crash bugs
- if ( c == '%' ) {
- c = '.';
- }
// don't allow higher ascii values
if ( c > 127 ) {
c = '.';
@@ -504,10 +496,6 @@ char *MSG_ReadStringLine( msg_t *msg ) {
if (c == -1 || c == 0 || c == '\n') {
break;
}
- // translate all fmt spec to avoid crash bugs
- if ( c == '%' ) {
- c = '.';
- }
// don't allow higher ascii values
if ( c > 127 ) {
c = '.';
diff --git a/src/qcommon/parse.c b/src/qcommon/parse.c
index 9308aa6e..2156f75b 100644
--- a/src/qcommon/parse.c
+++ b/src/qcommon/parse.c
@@ -979,7 +979,7 @@ static void Parse_StripDoubleQuotes(char *string)
{
if (*string == '\"')
{
- strcpy(string, string+1);
+ memmove( string, string + 1, strlen( string ) + 1 );
}
if (string[strlen(string)-1] == '\"')
{
diff --git a/src/server/sv_net_chan.c b/src/server/sv_net_chan.c
index e1d835d3..0de49d4f 100644
--- a/src/server/sv_net_chan.c
+++ b/src/server/sv_net_chan.c
@@ -65,7 +65,7 @@ static void SV_Netchan_Encode( client_t *client, msg_t *msg ) {
// modify the key with the last received and with this message acknowledged client command
if (!string[index])
index = 0;
- if (string[index] > 127 || string[index] == '%') {
+ if (string[index] > 127) {
key ^= '.' << (i & 1);
}
else {
@@ -115,7 +115,7 @@ static void SV_Netchan_Decode( client_t *client, msg_t *msg ) {
// modify the key with the last sent and acknowledged server command
if (!string[index])
index = 0;
- if (string[index] > 127 || string[index] == '%') {
+ if (string[index] > 127) {
key ^= '.' << (i & 1);
}
else {