summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-23 13:53:05 +0000
committertruelight <truelight@openttd.org>2004-12-23 13:53:05 +0000
commit2f2842ec05feb7927f97416d893cb8ce040d19b1 (patch)
tree2af4202f587c7b007b6e2a3ef1697b3c620bcc00
parent807b5e5304436f721de2631be4cc2def19a2fb8b (diff)
downloadopenttd-2f2842ec05feb7927f97416d893cb8ce040d19b1.tar.xz
(svn r1246) -Fix: [ 1090099 ] Company-messages did crash the game, because
company-index was sent, which should have been the client-index
-rw-r--r--network_client.c2
-rw-r--r--network_server.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/network_client.c b/network_client.c
index b929af1ba..e99a45794 100644
--- a/network_client.c
+++ b/network_client.c
@@ -619,6 +619,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
case NETWORK_ACTION_CHAT_PLAYER:
case NETWORK_ACTION_GIVE_MONEY:
/* For speak to player or give money, we need the player-name */
+ if (ci_to->client_playas > MAX_PLAYERS)
+ return NETWORK_RECV_STATUS_OKAY; // This should never happen
GetString(name, DEREF_PLAYER(ci_to->client_playas-1)->name_1);
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
break;
diff --git a/network_server.c b/network_server.c
index a42d7b5c8..91ff13e1c 100644
--- a/network_server.c
+++ b/network_server.c
@@ -995,7 +995,7 @@ void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest,
} else {
FOR_ALL_CLIENTS(cs) {
if (cs->index == from_index) {
- SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, dest, true, msg);
+ SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, ci_to->client_index, true, msg);
}
}
}