network_server.c
changeset 3623 2dd90d28fe20
parent 3437 2768c018e5f7
child 4026 f6faccd92b1c
--- a/network_server.c	Sat Apr 22 09:25:36 2006 +0000
+++ b/network_server.c	Sat Apr 22 09:46:31 2006 +0000
@@ -567,7 +567,7 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
 {
-	char name[NETWORK_NAME_LENGTH];
+	char name[NETWORK_CLIENT_NAME_LENGTH];
 	char unique_id[NETWORK_NAME_LENGTH];
 	NetworkClientInfo *ci;
 	byte playas;
@@ -612,7 +612,7 @@
 	}
 
 	// We need a valid name.. make it Player
-	if (name[0] == '\0') snprintf(name, sizeof(name), "Player");
+	if (*name == '\0') ttd_strlcpy(name, "Player", sizeof(name));
 
 	if (!NetworkFindName(name)) { // Change name if duplicate
 		// We could not create a name for this player
@@ -622,8 +622,8 @@
 
 	ci = DEREF_CLIENT_INFO(cs);
 
-	snprintf(ci->client_name, sizeof(ci->client_name), "%s", name);
-	snprintf(ci->unique_id, sizeof(ci->unique_id), "%s", unique_id);
+	ttd_strlcpy(ci->client_name, name, sizeof(ci->client_name));
+	ttd_strlcpy(ci->unique_id, unique_id, sizeof(ci->unique_id));
 	ci->client_playas = playas;
 	ci->client_lang = client_lang;
 
@@ -1389,7 +1389,7 @@
 	byte number = 0;
 	char original_name[NETWORK_CLIENT_NAME_LENGTH];
 
-	// We use NETWORK_NAME_LENGTH in here, because new_name is really a pointer
+	// We use NETWORK_CLIENT_NAME_LENGTH in here, because new_name is really a pointer
 	ttd_strlcpy(original_name, new_name, NETWORK_CLIENT_NAME_LENGTH);
 
 	while (!found_name) {