mirror of
https://github.com/uowuo/abaddon.git
synced 2026-08-15 05:19:58 +00:00
fix not respecting libsodiums reported mlen on decrypt
This commit is contained in:
1 parent
fd952a4cf0
commit
dbf81151e3
1 file changed
+3
-2
@@ -500,11 +500,12 @@ void DiscordVoiceClient::OnUDPData(std::vector<uint8_t> data) {
|
||||
const bool has_extension_header = (data[0] & 0b00010000) != 0;
|
||||
size_t ext_size = has_extension_header ? 4 : 0;
|
||||
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(data.data() + 12 + ext_size, nullptr, nullptr, data.data() + 12 + ext_size, data.size() - 12 - ext_size - sizeof(uint32_t), data.data(), 12 + ext_size, nonce.data(), m_secret_key.data())) {
|
||||
unsigned long long mlen = 0;
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(data.data() + 12 + ext_size, &mlen, nullptr, data.data() + 12 + ext_size, data.size() - 12 - ext_size - sizeof(uint32_t), data.data(), 12 + ext_size, nonce.data(), m_secret_key.data())) {
|
||||
// spdlog::get("voice")->trace("UDP payload decryption failure");
|
||||
} else {
|
||||
const auto opus_offset = GetPayloadOffset(data.data(), data.size());
|
||||
Abaddon::Get().GetAudio().FeedMeOpus(ssrc, { data.data() + opus_offset, data.data() + data.size() - sizeof(uint32_t) });
|
||||
Abaddon::Get().GetAudio().FeedMeOpus(ssrc, { data.data() + opus_offset, data.data() + 12 + ext_size + mlen });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user