diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/_cffi_src/openssl/err.py | 1 | ||||
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/binding.py | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/_cffi_src/openssl/err.py b/src/_cffi_src/openssl/err.py index 55f2470f..57704295 100644 --- a/src/_cffi_src/openssl/err.py +++ b/src/_cffi_src/openssl/err.py @@ -231,7 +231,6 @@ static const int X509_R_CERT_ALREADY_IN_HASH_TABLE; """ FUNCTIONS = """ -char *ERR_error_string(unsigned long, char *); void ERR_error_string_n(unsigned long, char *, size_t); const char *ERR_lib_error_string(unsigned long); const char *ERR_func_error_string(unsigned long); diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py index 7790213e..7d528adb 100644 --- a/src/cryptography/hazmat/bindings/openssl/binding.py +++ b/src/cryptography/hazmat/bindings/openssl/binding.py @@ -55,9 +55,10 @@ def _openssl_assert(lib, ok): errors = _consume_errors(lib) errors_with_text = [] for err in errors: - err_text_reason = ffi.string( - lib.ERR_error_string(err.code, ffi.NULL) - ) + buf = ffi.new("char[]", 256) + lib.ERR_error_string_n(err.code, buf, len(buf)) + err_text_reason = ffi.string(buf) + errors_with_text.append( _OpenSSLErrorWithText( err.code, err.lib, err.func, err.reason, err_text_reason |