diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-12-18 10:24:17 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-12-18 09:24:17 -0600 |
commit | 5db4e5e77ee40521cd732058262e228be4430588 (patch) | |
tree | 81d3dfa9f9a3066f45dbc7155f2108854561b3ca /src | |
parent | 582b2b4d85c4bb902beab05fb3044d96c49c910f (diff) | |
download | cryptography-5db4e5e77ee40521cd732058262e228be4430588.tar.gz cryptography-5db4e5e77ee40521cd732058262e228be4430588.tar.bz2 cryptography-5db4e5e77ee40521cd732058262e228be4430588.zip |
Fixed #4058 -- use the thread-safe API from OpenSSL, not the danger one (#4059)
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 |