summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-12-01 22:03:44 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-12-01 22:03:44 (GMT)
commitea315ac8f4890538ad23c5247c2cc7dfa7e9f985 (patch)
tree1998254f0bcbed54e4a26f8d876dc3579db0e30c /Modules
parent6c8ee7a33309b79d9f2737616501835349cfcdaf (diff)
downloadcpython-ea315ac8f4890538ad23c5247c2cc7dfa7e9f985.zip
cpython-ea315ac8f4890538ad23c5247c2cc7dfa7e9f985.tar.gz
cpython-ea315ac8f4890538ad23c5247c2cc7dfa7e9f985.tar.bz2
Merged revisions 76626 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76626 | amaury.forgeotdarc | 2009-12-01 22:59:18 +0100 (mar., 01 déc. 2009) | 10 lines Merged revisions 76625 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76625 | amaury.forgeotdarc | 2009-12-01 22:51:04 +0100 (mar., 01 déc. 2009) | 3 lines #7419: Fix a crash on Windows in locale.setlocale() when the category is outside the allowed range. ........ ................
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_localemodule.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index fa6ab8f..aabc3ac 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -133,6 +133,14 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale))
return NULL;
+#if defined(MS_WINDOWS)
+ if (category < LC_MIN || category > LC_MAX)
+ {
+ PyErr_SetString(Error, "invalid locale category");
+ return NULL;
+ }
+#endif
+
if (locale) {
/* set locale */
result = setlocale(category, locale);