mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() (GH-21407)
(cherry picked from commit ee96f32ca2
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
e68978978f
commit
90584c02b4
2 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue