Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8754a1

Browse files
committed
Closes #15793: Stack corruption in ssl.RAND_egd()
1 parent e8db356 commit c8754a1

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,8 @@ def test_random(self):
103103
sys.stdout.write("\n RAND_status is %d (%s)\n"
104104
% (v, (v and "sufficient randomness") or
105105
"insufficient randomness"))
106-
try:
107-
ssl.RAND_egd(1)
108-
except TypeError:
109-
pass
110-
else:
111-
print("didn't raise TypeError")
106+
self.assertRaises(TypeError, ssl.RAND_egd, 1)
107+
self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
112108
ssl.RAND_add("this is a random string", 75.0)
113109

114110
def test_parse_cert(self):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ Library
154154

155155
- Issue #13579: string.Formatter now understands the 'a' conversion specifier.
156156

157+
- Issue #15793: Stack corruption in ssl.RAND_egd().
158+
Patch by Serhiy Storchaka.
159+
157160
- Issue #15595: Fix subprocess.Popen(universal_newlines=True)
158161
for certain locales (utf-16 and utf-32 family). Patch by Chris Jerdonek.
159162

Modules/_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *args)
19171917
PyObject *path;
19181918
int bytes;
19191919

1920-
if (!PyArg_ParseTuple(args, "O&|i:RAND_egd",
1920+
if (!PyArg_ParseTuple(args, "O&:RAND_egd",
19211921
PyUnicode_FSConverter, &path))
19221922
return NULL;
19231923

0 commit comments

Comments
 (0)