Reinforce PacketUtils writing (#1073)

Ensure the correct size is written to the bitstream.  It is always supposed to write 64 bits.
This commit is contained in:
David Markowitz 2023-05-06 23:45:07 -07:00 committed by GitHub
parent 33c12f3bc5
commit 7e61638595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,10 +10,10 @@ enum class eConnectionType : uint16_t;
namespace PacketUtils {
template<typename T>
void WriteHeader(RakNet::BitStream& bitStream, eConnectionType connectionType, T internalPacketID) {
bitStream.Write(MessageID(ID_USER_PACKET_ENUM));
bitStream.Write(connectionType);
bitStream.Write(internalPacketID);
bitStream.Write(uint8_t(0));
bitStream.Write<uint8_t>(MessageID(ID_USER_PACKET_ENUM));
bitStream.Write<eConnectionType>(connectionType);
bitStream.Write<uint32_t>(static_cast<uint32_t>(internalPacketID));
bitStream.Write<uint8_t>(0);
}
uint16_t ReadPacketU16(uint32_t startLoc, Packet* packet);