increase length check in _unpickle_context

The length check len(name) < 100 fails if longer hostnames are used.
A hostname may be 255 bytes long, in addition with ssh as transport and if a bastion host is used this may result in a 518 character long string (ssh.<bastionhost>.ssh.<targethost> ~max 4 + 255 +4 + 255 ).
So the length check should be increased to allow max 518 character.
pull/825/head
christian-wa 4 years ago committed by GitHub
parent 36f3e3b28c
commit 09124abc9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2309,7 +2309,7 @@ class Context(object):
def _unpickle_context(context_id, name, router=None): def _unpickle_context(context_id, name, router=None):
if not (isinstance(context_id, (int, long)) and context_id >= 0 and ( if not (isinstance(context_id, (int, long)) and context_id >= 0 and (
(name is None) or (name is None) or
(isinstance(name, UnicodeType) and len(name) < 100)) (isinstance(name, UnicodeType) and len(name) < 519))
): ):
raise TypeError('cannot unpickle Context: bad input') raise TypeError('cannot unpickle Context: bad input')

Loading…
Cancel
Save