Skip to content

Commit

Permalink
Work around a bug user auth banner message generated by cryptlib
Browse files Browse the repository at this point in the history
This commit works around the inclusion of an extra NUL byte in
user auth banner messages generated by the cryptlib library.
Thanks go to GitHub user mmayomoar for reporting this issue and
suggesting a fix.
  • Loading branch information
ronf committed Jun 25, 2024
1 parent f2020ed commit 3242743
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions asyncssh/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2501,6 +2501,13 @@ def _process_userauth_banner(self, _pkttype: int, _pktid: int,

msg_bytes = packet.get_string()
lang_bytes = packet.get_string()

# Work around an extra NUL byte appearing in the user
# auth banner message in some versions of cryptlib
if b'cryptlib' in self._server_version and \
packet.get_remaining_payload() == b'\0': # pragma: no cover
packet.get_byte()

packet.check_end()

try:
Expand Down

0 comments on commit 3242743

Please sign in to comment.