diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index 5a2f492b6..3ed0f94d3 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -978,8 +978,8 @@ def set_alpn_protos(self, protos): # Build a C string from the list. We don't need to save this off # because OpenSSL immediately copies the data out. input_str = _ffi.new("unsigned char[]", protostr) - input_str_len = _ffi.new("unsigned", len(protostr)) - _lib.SSL_CTX_set_alpn_protos(self._context, input_str) + input_str_len = _ffi.cast("unsigned", len(protostr)) + _lib.SSL_CTX_set_alpn_protos(self._context, input_str, input_str_len) def set_alpn_select_callback(self, callback): """