"Do not index an array out of bounds when displaying a chat message from another player with an invalid (unknown) dpid."
Thanks to gerard for the elaboration of the description. ;) git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7460 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
1ed583995a
commit
e89dc5e8ec
|
@ -1109,12 +1109,19 @@ BOOL sendTextMessage(const char *pStr, BOOL all)
|
|||
}
|
||||
|
||||
//This is for local display
|
||||
for(i = 0; NetPlay.players[i].dpid != NetPlay.dpidPlayer; i++); //findplayer
|
||||
sstrcat(display, NetPlay.players[i].name); // name
|
||||
sstrcat(display, ": "); // seperator
|
||||
sstrcat(display, pStr); // add message
|
||||
for (i = 0; i < ARRAY_SIZE(NetPlay.players); ++i)
|
||||
{
|
||||
if (NetPlay.players[i].dpid == NetPlay.dpidPlayer)
|
||||
{
|
||||
sstrcat(display, NetPlay.players[i].name); // name
|
||||
sstrcat(display, ": "); // seperator
|
||||
sstrcat(display, pStr); // add message
|
||||
|
||||
addConsoleMessage(display, DEFAULT_JUSTIFY, selectedPlayer); // display
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
addConsoleMessage(display, DEFAULT_JUSTIFY, selectedPlayer); // display
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue