diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-16 21:45:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-16 21:45:39 (GMT) |
commit | 8d91d454d5adf26eb0eacbaddb834f20238bb793 (patch) | |
tree | 23ea14e3117362f27ed1902d2c4412cc3d8ce4cf | |
parent | 4b779b3785c0014224eef95c8805f166d0ef2a86 (diff) | |
download | cpython-8d91d454d5adf26eb0eacbaddb834f20238bb793.zip cpython-8d91d454d5adf26eb0eacbaddb834f20238bb793.tar.gz cpython-8d91d454d5adf26eb0eacbaddb834f20238bb793.tar.bz2 |
Issue #10653: Fix time.strftime() on Windows, check for invalid format strings
-rw-r--r-- | Modules/timemodule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 34e4875..bc908c0 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -508,16 +508,16 @@ time_strftime(PyObject *self, PyObject *args) fmt = PyBytes_AS_STRING(format); #endif -#if defined(MS_WINDOWS) && defined(HAVE_WCSFTIME) +#if defined(MS_WINDOWS) /* check that the format string contains only valid directives */ - for(outbuf = wcschr(fmt, L'%'); + for(outbuf = strchr(fmt, '%'); outbuf != NULL; - outbuf = wcschr(outbuf+2, L'%')) + outbuf = strchr(outbuf+2, '%')) { if (outbuf[1]=='#') ++outbuf; /* not documented by python, */ if (outbuf[1]=='\0' || - !wcschr(L"aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) + !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) { PyErr_SetString(PyExc_ValueError, "Invalid format string"); return 0; |