summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-09-07 05:18:36 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-09-07 05:18:36 (GMT)
commitaa2fcc6b35e92ee7a8b1396ee454a9f92936c850 (patch)
tree8d6c2fd47edccf24f91469588df08904bba97c17
parente8d58d1f022b41e3da80ccca7bf3586e2898874a (diff)
downloadcpython-aa2fcc6b35e92ee7a8b1396ee454a9f92936c850.zip
cpython-aa2fcc6b35e92ee7a8b1396ee454a9f92936c850.tar.gz
cpython-aa2fcc6b35e92ee7a8b1396ee454a9f92936c850.tar.bz2
Issue #24917: time_strftime() buffer over-read.
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/timemodule.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 7a3c22c..ac0541b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -81,6 +81,8 @@ Core and Builtins
Library
-------
+- Issue #24917: time_strftime() buffer over-read.
+
- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even
when convert_charrefs is True.
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index d0917a4..d71b3ac 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -655,6 +655,8 @@ time_strftime(PyObject *self, PyObject *args)
outbuf != NULL;
outbuf = wcschr(outbuf+2, '%'))
{
+ if (outbuf[1] == L'\0')
+ break;
/* Issue #19634: On AIX, wcsftime("y", (1899, 1, 1, 0, 0, 0, 0, 0, 0))
returns "0/" instead of "99" */
if (outbuf[1] == L'y' && buf.tm_year < 0) {