mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 22:11:18 +00:00
Fix MSG_Read*String*() functions not being able to read last byte from message
This is exact root of q3msgboom bug http://aluigi.altervista.org/adv/q3msgboom-adv.txt Unfortunately, server still need this ugly '1022 char limit' hack to support unfixed clients in some degree. And as it affects MSG_ReadBigString() - unfixed clients can still be crashed by 8191-chars long configstrings that comes with gamestate
This commit is contained in:
parent
3bf48877f3
commit
9f294ce520
1 changed files with 21 additions and 15 deletions
|
@ -462,12 +462,14 @@ char *MSG_ReadString( msg_t *msg ) {
|
|||
if ( c > 127 ) {
|
||||
c = '.';
|
||||
}
|
||||
// break only after reading all expected data from bitstream
|
||||
if ( l >= sizeof(string)-1 ) {
|
||||
break;
|
||||
}
|
||||
string[l++] = c;
|
||||
} while (1);
|
||||
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string)-1);
|
||||
|
||||
string[l] = 0;
|
||||
string[l] = '\0';
|
||||
|
||||
return string;
|
||||
}
|
||||
|
@ -490,12 +492,14 @@ char *MSG_ReadBigString( msg_t *msg ) {
|
|||
if ( c > 127 ) {
|
||||
c = '.';
|
||||
}
|
||||
// break only after reading all expected data from bitstream
|
||||
if ( l >= sizeof(string)-1 ) {
|
||||
break;
|
||||
}
|
||||
string[l++] = c;
|
||||
} while (1);
|
||||
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string)-1);
|
||||
|
||||
string[l] = 0;
|
||||
string[l] = '\0';
|
||||
|
||||
return string;
|
||||
}
|
||||
|
@ -518,12 +522,14 @@ char *MSG_ReadStringLine( msg_t *msg ) {
|
|||
if ( c > 127 ) {
|
||||
c = '.';
|
||||
}
|
||||
// break only after reading all expected data from bitstream
|
||||
if ( l >= sizeof(string)-1 ) {
|
||||
break;
|
||||
}
|
||||
string[l++] = c;
|
||||
} while (1);
|
||||
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string)-1);
|
||||
|
||||
string[l] = 0;
|
||||
string[l] = '\0';
|
||||
|
||||
return string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue