Commit 5839060
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 ee902ce commit 5839060
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 | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| 847 | + | |
847 | 848 | | |
848 | | - | |
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
| |||
0 commit comments