[Python-checkins] cpython (3.4): Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.

steve.dower python-checkins at python.org
Sun Sep 6 06:02:05 CEST 2015


https://hg.python.org/cpython/rev/a29b49d57769
changeset:   97694:a29b49d57769
branch:      3.4
parent:      97687:2d4aac2ab253
user:        Steve Dower <steve.dower at microsoft.com>
date:        Sat Sep 05 20:55:34 2015 -0700
summary:
  Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.

files:
  Misc/NEWS            |  2 ++
  Modules/timemodule.c |  6 ++++++
  2 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -84,6 +84,8 @@
 - Issue #16180: Exit pdb if file has syntax error, instead of trapping user
   in an infinite loop.  Patch by Xavier de Gaye.
 
+- Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.
+
 - Issue #21112: Fix regression in unittest.expectedFailure on subclasses.
   Patch from Berker Peksag.
 
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -662,6 +662,12 @@
                             "format %y requires year >= 1900 on AIX");
             return NULL;
         }
+        else if (outbuf[1] == '\0')
+        {
+            PyErr_SetString(PyExc_ValueError, "Incomplete format string");
+            Py_DECREF(format);
+            return NULL;
+        }
     }
 #endif
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list