Updated changelog

This commit is contained in:
WolverinDEV 2019-07-07 18:52:23 +02:00
parent b800b2373b
commit 40870d8553
1 changed files with 11 additions and 1 deletions

View File

@ -276,6 +276,15 @@ bool CryptionHandler::decryptPacket(protocol::BasicPacket *packet, std::string &
return false;
}
size_t target_length = 2048;
uint8_t target_buffer[2048];
auto length = data.length();
if(target_length < length) {
error = "buffer too large";
return false;
}
err = eax_decrypt_verify_memory(find_cipher("rijndael"),
(uint8_t *) key, /* the key */
(unsigned long) 16, /* key is 16 bytes */
@ -285,7 +294,7 @@ bool CryptionHandler::decryptPacket(protocol::BasicPacket *packet, std::string &
(unsigned long) header.length(), /* header length */
(const unsigned char *) data.data_ptr(),
(unsigned long) data.length(),
(unsigned char *) data.data_ptr(),
(unsigned char *) target_buffer,
(unsigned char *) packet->mac().data_ptr(),
(unsigned long) packet->mac().length(),
&success
@ -300,6 +309,7 @@ bool CryptionHandler::decryptPacket(protocol::BasicPacket *packet, std::string &
return false;
}
packet->data(pipes::buffer_view{target_buffer, length});
packet->setEncrypted(false);
return true;
}