Commit 0d83a6f
pythongh-144833: Fix use-after-free in SSL module when SSL_new() fails (pythonGH-144843)
In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.
Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638c)
Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>1 parent e1a8a03 commit 0d83a6f
File tree
2 files changed
+4
-1
lines changed- Misc/NEWS.d/next/Library
- Modules
2 files changed
+4
-1
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
| 849 | + | |
849 | 850 | | |
850 | | - | |
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| |||
0 commit comments