summaryrefslogtreecommitdiff
path: root/src/network/network_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r--src/network/network_server.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 39da21632..791d766d7 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1373,12 +1373,21 @@ DEF_GAME_RECEIVE_COMMAND(Server, PACKET_CLIENT_MOVE)
return NETWORK_RECV_STATUS_OKAY;
}
-void NetworkSocketHandler::SendCompanyInformation(Packet *p, const Company *c, const NetworkCompanyStats *stats)
+/**
+ * Package some generic company information into a packet.
+ * @param p The packet that will contain the data.
+ * @param c The company to put the of into the packet.
+ * @param stats The statistics to put in the packet.
+ * @param max_len The maximum length of the company name.
+ */
+void NetworkSocketHandler::SendCompanyInformation(Packet *p, const Company *c, const NetworkCompanyStats *stats, uint max_len)
{
/* Grab the company name */
char company_name[NETWORK_COMPANY_NAME_LENGTH];
SetDParam(0, c->index);
- GetString(company_name, STR_COMPANY_NAME, lastof(company_name));
+
+ assert(max_len <= lengthof(company_name));
+ GetString(company_name, STR_COMPANY_NAME, company_name + max_len - 1);
/* Get the income */
Money income = 0;