Protocol padding fixes

This commit is contained in:
Daniil Gentili 2018-12-27 18:22:05 +01:00
parent 79f7d92767
commit a0bc08b33e
2 changed files with 2 additions and 4 deletions

View File

@ -152,7 +152,7 @@ class ReadLoop extends SignalLoop
if ($left) {
$API->logger->logger('Padded unencrypted message', \danog\MadelineProto\Logger::ULTRA_VERBOSE);
if ($left < (-$message_length & 15)) {
throw new \danog\MadelineProto\SecurityException('padding is too small');
$API->logger->logger('Protocol padded unencrypted message', \danog\MadelineProto\Logger::ULTRA_VERBOSE);
}
yield $buffer->bufferRead($left);
}

View File

@ -62,9 +62,7 @@ class WriteLoop extends ResumableSignalLoop
} else {
$res = $this->encryptedWriteLoopAsync();
}
if ($res instanceof \Generator) {
yield new Coroutine($res);
}
yield $res;
} finally {
$this->exitedLoop();
}