summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-09-11 00:08:48 (GMT)
committerJesus Cea <jcea@jcea.es>2012-09-11 00:08:48 (GMT)
commitb7a28008313f793897cc733e30c319ec2c284dbe (patch)
treea8f51234e96cbcabadfabef6442346b947f024ba
parent67bd81b8671e98149dcb3207e774e7abfd6159f2 (diff)
parentc8754a13e607ebc70f12a10297c76dc574a91d5b (diff)
downloadcpython-b7a28008313f793897cc733e30c319ec2c284dbe.zip
cpython-b7a28008313f793897cc733e30c319ec2c284dbe.tar.gz
cpython-b7a28008313f793897cc733e30c319ec2c284dbe.tar.bz2
MERGE: Closes #15793: Stack corruption in ssl.RAND_egd()
-rw-r--r--Lib/test/test_ssl.py8
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_ssl.c2
3 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 51762cf..4ce98b6 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -125,12 +125,8 @@ class BasicSocketTests(unittest.TestCase):
else:
self.assertRaises(ssl.SSLError, ssl.RAND_bytes, 16)
- try:
- ssl.RAND_egd(1)
- except TypeError:
- pass
- else:
- print("didn't raise TypeError")
+ self.assertRaises(TypeError, ssl.RAND_egd, 1)
+ self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
ssl.RAND_add("this is a random string", 75.0)
def test_parse_cert(self):
diff --git a/Misc/NEWS b/Misc/NEWS
index de603c4..d1aeaec 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -210,6 +210,9 @@ Library
- Issue #13579: string.Formatter now understands the 'a' conversion specifier.
+- Issue #15793: Stack corruption in ssl.RAND_egd().
+ Patch by Serhiy Storchaka.
+
- Issue #15595: Fix subprocess.Popen(universal_newlines=True)
for certain locales (utf-16 and utf-32 family). Patch by Chris Jerdonek.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 1104a4e..456b1f1 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2481,7 +2481,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *args)
PyObject *path;
int bytes;
- if (!PyArg_ParseTuple(args, "O&|i:RAND_egd",
+ if (!PyArg_ParseTuple(args, "O&:RAND_egd",
PyUnicode_FSConverter, &path))
return NULL;