diff options
| author | Cory Benfield <lukasaoz@gmail.com> | 2015-04-12 08:57:03 -0400 |
|---|---|---|
| committer | Cory Benfield <lukasaoz@gmail.com> | 2015-04-13 16:11:48 -0400 |
| commit | 63759dc59052fc53b159bc139ab9fa9ecfc5ae85 (patch) | |
| tree | 68742e665ab2d7882317731d698202517fe3ebdf /OpenSSL/SSL.py | |
| parent | 75279586aeb281d1bd0e7e3ef062cde6640dcac6 (diff) | |
| download | pyopenssl-63759dc59052fc53b159bc139ab9fa9ecfc5ae85.tar.gz | |
Catch non-bytestrings from ALPN callbacks.
Diffstat (limited to 'OpenSSL/SSL.py')
| -rw-r--r-- | OpenSSL/SSL.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index 1e40917..cc2472f 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -5,6 +5,7 @@ from weakref import WeakValueDictionary from errno import errorcode from six import text_type as _text_type +from six import binary_type as _binary_type from six import integer_types as integer_types from six import int2byte, indexbytes @@ -1004,6 +1005,9 @@ class Context(object): # Call the callback outstr = callback(conn, protolist) + if not isinstance(outstr, _binary_type): + raise TypeError("ALPN callback must return a bytestring.") + # Save our callback arguments on the connection object to make sure # that they don't get freed before OpenSSL can use them. Then, # return them in the appropriate output parameters. |
