Przeglądaj źródła

Send biography packet only if the biography is set

Image 3 lat temu
rodzic
commit
49bb456594
1 zmienionych plików z 15 dodań i 2 usunięć
  1. 15 2
      EQ2/source/WorldServer/client.cpp

+ 15 - 2
EQ2/source/WorldServer/client.cpp

@@ -9233,7 +9233,20 @@ void Client::SendBiography() {
 	PacketStruct* packet = configReader.getStruct("WS_BioUpdate", GetVersion());
 	if (packet) {
 		char biography[512];
-		strncpy(biography, player->GetInfoStruct()->get_biography().c_str(), player->GetInfoStruct()->get_biography().size());
+		if(player->GetInfoStruct()->get_biography().size() < 1)
+		{
+			safe_delete(packet);
+			return;
+		}
+		else
+		{
+			int16 size = player->GetInfoStruct()->get_biography().size();
+			if(size>511)
+				size = 511;
+			
+			strncpy(biography, player->GetInfoStruct()->get_biography().c_str(), player->GetInfoStruct()->get_biography().size());
+			biography[player->GetInfoStruct()->get_biography().size()] = '\0';
+		}
 		packet->setDataByName("biography", biography);
 
 		QueuePacket(packet->serialize());
@@ -10278,4 +10291,4 @@ void Client::AwardCoins(int64 total_coins, std::string reason)
 		int8 type = CHANNEL_LOOT;
 		SimpleMessage(type, message.c_str());
 		}
-}
+}