Browse Source
bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() (GH-21407)
pull/20976/merge
Zackery Spytz
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
1 deletions
-
Misc/NEWS.d/next/Core and Builtins/2020-07-08-21-55-23.bpo-41252.nBWL-Y.rst
-
Modules/_ssl.c
|
|
|
@ -0,0 +1 @@ |
|
|
|
Fix incorrect refcounting in _ssl.c's ``_servername_callback()``. |
|
|
|
@ -4545,11 +4545,12 @@ _servername_callback(SSL *s, int *al, void *args) |
|
|
|
* back into a str object, but still as an A-label (bpo-28414) |
|
|
|
*/ |
|
|
|
servername_str = PyUnicode_FromEncodedObject(servername_bytes, "ascii", NULL); |
|
|
|
Py_DECREF(servername_bytes); |
|
|
|
if (servername_str == NULL) { |
|
|
|
PyErr_WriteUnraisable(servername_bytes); |
|
|
|
Py_DECREF(servername_bytes); |
|
|
|
goto error; |
|
|
|
} |
|
|
|
Py_DECREF(servername_bytes); |
|
|
|
result = PyObject_CallFunctionObjArgs( |
|
|
|
ssl_ctx->set_sni_cb, ssl_socket, servername_str, |
|
|
|
ssl_ctx, NULL); |
|
|
|
|