summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2005-11-07 07:15:48 (GMT)
committerArmin Rigo <arigo@tunes.org>2005-11-07 07:15:48 (GMT)
commitf4afb215262eabfbad00eeb7997b7e9522911eb3 (patch)
treea2d63ced0873743bbf5f1e634cd8eeb808e9dc7e /Modules
parent9a2dcf8ac1ef89d03c2978e7b1ef4b36cc2fa9f8 (diff)
downloadcpython-f4afb215262eabfbad00eeb7997b7e9522911eb3.zip
cpython-f4afb215262eabfbad00eeb7997b7e9522911eb3.tar.gz
cpython-f4afb215262eabfbad00eeb7997b7e9522911eb3.tar.bz2
similar to SF bug 847019: a quick check in the time() constructor, which
accepts strings only for unpickling reasons. This check prevents the honest mistake of passing a string like '2:59.0' to time() and getting an insane object.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/datetimemodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 7c1a6d0..6b44fe5 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3046,7 +3046,8 @@ time_new(PyTypeObject *type, PyObject *args, PyObject *kw)
if (PyTuple_GET_SIZE(args) >= 1 &&
PyTuple_GET_SIZE(args) <= 2 &&
PyString_Check(state = PyTuple_GET_ITEM(args, 0)) &&
- PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE)
+ PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE &&
+ ((unsigned char) (PyString_AS_STRING(state)[0])) < 24)
{
PyDateTime_Time *me;
char aware;