Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r91957:a92ebe04ee55
Date: 2017-07-23 09:38 +0200
http://bitbucket.org/pypy/pypy/changeset/a92ebe04ee55/
Log: Issue #2615
Don't use a static buffer. Corruption in a multithreaded
environment!
diff --git a/lib_pypy/_cffi_ssl/_stdssl/certificate.py
b/lib_pypy/_cffi_ssl/_stdssl/certificate.py
--- a/lib_pypy/_cffi_ssl/_stdssl/certificate.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/certificate.py
@@ -173,14 +173,13 @@
return tuple(dn)
-STATIC_BIO_BUF = ffi.new("char[]", 2048)
-
def _bio_get_str(biobuf):
- length = lib.BIO_gets(biobuf, STATIC_BIO_BUF, len(STATIC_BIO_BUF)-1)
+ bio_buf = ffi.new("char[]", 2048)
+ length = lib.BIO_gets(biobuf, bio_buf, len(bio_buf)-1)
if length < 0:
if biobuf: lib.BIO_free(biobuf)
raise ssl_error(None)
- return _str_with_len(STATIC_BIO_BUF, length)
+ return _str_with_len(bio_buf, length)
def _decode_certificate(certificate):
retval = {}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit