diff --git a/td/mtproto/Transport.cpp b/td/mtproto/Transport.cpp index 9d90e18a0..9498ea00d 100644 --- a/td/mtproto/Transport.cpp +++ b/td/mtproto/Transport.cpp @@ -227,11 +227,7 @@ Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &a auto *header = reinterpret_cast(message.begin()); *header_ptr = header; auto to_decrypt = MutableSlice(header->encrypt_begin(), message.uend()); - to_decrypt.truncate(to_decrypt.size() & ~15); - if (to_decrypt.size() % 16 != 0) { - return Status::Error(PSLICE() << "Invalid mtproto message: size of encrypted part is not multiple of 16 [size = " - << to_decrypt.size() << "]"); - } + to_decrypt.remove_suffix(to_decrypt.size() & 15); if (header->auth_key_id != auth_key.id()) { return Status::Error(PSLICE() << "Invalid mtproto message: auth_key_id mismatch [found = "