]> granicus.if.org Git - python/commitdiff
Closes #15793: Stack corruption in ssl.RAND_egd()
authorJesus Cea <jcea@jcea.es>
Tue, 11 Sep 2012 00:00:58 +0000 (02:00 +0200)
committerJesus Cea <jcea@jcea.es>
Tue, 11 Sep 2012 00:00:58 +0000 (02:00 +0200)
Lib/test/test_ssl.py
Misc/NEWS
Modules/_ssl.c

index 551151e873c12d208d1b4b5ca11ae7d03f285859..d4c5e6351a30c4dd933a7ddb8025b11a6e977213 100644 (file)
@@ -103,12 +103,8 @@ class BasicSocketTests(unittest.TestCase):
             sys.stdout.write("\n RAND_status is %d (%s)\n"
                              % (v, (v and "sufficient randomness") or
                                 "insufficient randomness"))
-        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):
index 725fb9e5c13eb64c2424783c44dc48da93c34eac..3b09e9633af52bbe93ae2ca573ac9f5e13b05878 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -154,6 +154,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.
 
index 0a841183a5fcb2c0fdb2c4c4701dbb41b78b7b13..e9de8cad2733fb574455be98f1b767981cc8b07b 100644 (file)
@@ -1917,7 +1917,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;