Ignore inbound unencrypted packets padding (0xdd transport)
GitOrigin-RevId: 7da991cb741b65fe2ade26ccc4fc3ef3c788db7a
This commit is contained in:
parent
d07c172ec8
commit
fdd898124b
@ -73,7 +73,8 @@ class HandshakeConnection
|
||||
}
|
||||
packet.confirm_read(12);
|
||||
|
||||
TRY_STATUS(handshake_->on_message(packet.as_slice(), this, context_.get()));
|
||||
auto fixed_packet_size = packet.size() & ~3; // remove some padded data
|
||||
TRY_STATUS(handshake_->on_message(packet.as_slice().truncate(fixed_packet_size), this, context_.get()));
|
||||
return Status::OK();
|
||||
}
|
||||
};
|
||||
|
@ -98,6 +98,7 @@ Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &a
|
||||
auto *header = &as<HeaderT>(message.begin());
|
||||
*header_ptr = header;
|
||||
auto to_decrypt = MutableSlice(header->encrypt_begin(), message.uend());
|
||||
to_decrypt = 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() << "]");
|
||||
@ -287,7 +288,7 @@ Result<uint64> Transport::read_auth_key_id(Slice message) {
|
||||
Status Transport::read(MutableSlice message, const AuthKey &auth_key, PacketInfo *info, MutableSlice *data,
|
||||
int32 *error_code) {
|
||||
if (message.size() < 8) {
|
||||
if (message.size() == 4) {
|
||||
if (message.size() >= 4) {
|
||||
*error_code = as<int32>(message.begin());
|
||||
return Status::OK();
|
||||
}
|
||||
|
Reference in New Issue
Block a user