(svn r1246) -Fix: [ 1090099 ] Company-messages did crash the game, because
authortruelight
Thu, 23 Dec 2004 13:53:05 +0000
changeset 779 1abefd084ffb
parent 778 e42ddfd9cc34
child 780 f7d6976a1fc8
(svn r1246) -Fix: [ 1090099 ] Company-messages did crash the game, because
company-index was sent, which should have been the client-index
network_client.c
network_server.c
--- a/network_client.c	Thu Dec 23 13:03:48 2004 +0000
+++ b/network_client.c	Thu Dec 23 13:53:05 2004 +0000
@@ -619,6 +619,8 @@
 			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;
--- a/network_server.c	Thu Dec 23 13:03:48 2004 +0000
+++ b/network_server.c	Thu Dec 23 13:53:05 2004 +0000
@@ -995,7 +995,7 @@
 			} 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);
 					}
 				}
 			}