Ignore padding on server messages instead warning

There's 12..1024 padding for the MTProto 2.0 protocol, and
the length of the message can be used to determine how much
must be read on rpc_results. However this random padding
can be safely ignored.
This commit is contained in:
Lonami Exo 2018-06-09 14:23:42 +02:00
parent be279ce3f5
commit 485ce5ca3b

View File

@ -119,13 +119,8 @@ class MTProtoState:
remote_msg_id = reader.read_long()
remote_sequence = reader.read_int()
msg_len = reader.read_int()
before = reader.tell_position()
reader.read_int() # msg_len for the inner object, padding ignored
obj = reader.tgread_object()
if reader.tell_position() != before + msg_len:
reader.set_position(before)
__log__.warning('Data left after TLObject {}: {!r}'
.format(obj, reader.read(msg_len)))
return TLMessage(remote_msg_id, remote_sequence, obj)