mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-02 21:04:20 +00:00
fix: security fixes (#1974)
* fix: security fixes dont print passwords for worlds bound strings from clients actually enable encryption between rakpeers dont allow underflow when reading a string Tested that packets are encrypted tested that models can still be built tested that combat still works * add check * use c++ nullptr instead of NULL * initialize to 0 * globalize constant (should be in a namespace at least in the future) * Update GameMessages.cpp * check bounds
This commit is contained in:
@@ -11,14 +11,16 @@ ChatMessage ClientPackets::HandleChatMessage(Packet* packet) {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
|
||||
ChatMessage message;
|
||||
uint32_t messageLength;
|
||||
int32_t messageLength{};
|
||||
|
||||
inStream.Read(message.chatChannel);
|
||||
inStream.Read(message.unknown);
|
||||
inStream.Read(messageLength);
|
||||
|
||||
for (uint32_t i = 0; i < (messageLength - 1); ++i) {
|
||||
uint16_t character;
|
||||
if (messageLength > MAX_MESSAGE_LENGTH || messageLength < 0) return message;
|
||||
|
||||
for (int32_t i = 0; i < (messageLength - 1); ++i) {
|
||||
char16_t character;
|
||||
inStream.Read(character);
|
||||
message.message.push_back(character);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user