]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #10653: Fix time.strftime() on Windows, check for invalid format strings
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 16 Oct 2011 17:08:23 +0000 (19:08 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 16 Oct 2011 17:08:23 +0000 (19:08 +0200)
Modules/timemodule.c

index f825c2cd436af87892aec9b66c75c89b8287823f..b7604b0c49675007f5e229806ecc4b6e41dd5c59 100644 (file)
@@ -463,16 +463,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;