summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-09-05 19:16:06 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-09-05 19:16:06 (GMT)
commit373602fa3f3e54ca4f7e7a87948b6df86a17a3e6 (patch)
tree6cdaeee966d45d9796e6f5f9c340cb7ed4565ea3 /Modules/timemodule.c
parent7d293ee97dbe27e2b6a43f900cf988572108c18e (diff)
downloadcpython-373602fa3f3e54ca4f7e7a87948b6df86a17a3e6.zip
cpython-373602fa3f3e54ca4f7e7a87948b6df86a17a3e6.tar.gz
cpython-373602fa3f3e54ca4f7e7a87948b6df86a17a3e6.tar.bz2
Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 197d2c0..55e26fa 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -623,6 +623,12 @@ time_strftime(PyObject *self, PyObject *args)
Py_DECREF(format);
return NULL;
}
+ else if (outbuf[1] == '\0')
+ {
+ PyErr_SetString(PyExc_ValueError, "Incomplete format string");
+ Py_DECREF(format);
+ return NULL;
+ }
}
#elif (defined(_AIX) || defined(sun)) && defined(HAVE_WCSFTIME)
for(outbuf = wcschr(fmt, '%');
@@ -636,6 +642,12 @@ time_strftime(PyObject *self, PyObject *args)
"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