mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
fixed a potential 1-byte buffer overflow in CL_ServerInfoPacket
This commit is contained in:
parent
dcb3c80998
commit
928a8df74a
1 changed files with 4 additions and 5 deletions
|
@ -401,11 +401,10 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
|
|||
cls.localServers[i].punkbuster = 0;
|
||||
|
||||
Q_strncpyz( info, MSG_ReadString( msg ), MAX_INFO_STRING );
|
||||
if (info[0]) {
|
||||
if (info[strlen(info)-1] != '\n') {
|
||||
strncat(info, "\n", sizeof(info));
|
||||
}
|
||||
Com_Printf( "%s: %s", NET_AdrToString( from ), info );
|
||||
const int infoLength = strlen( info );
|
||||
if ( infoLength > 0 ) {
|
||||
const qbool hasLineFeed = info[infoLength - 1] == '\n';
|
||||
Com_Printf( "%s: %s%s", NET_AdrToString( from ), info, hasLineFeed ? "" : "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue