diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-20 06:53:58 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-20 06:53:58 (GMT) |
commit | 2b0d2007a1a51a15a67dc7297cf5e21c8767b563 (patch) | |
tree | 4e8eebbb9db682202b19d2a8af246ed3cc730fb8 /Modules/posixmodule.c | |
parent | 2ef7c478444f453a04ae63ecc3d3de07915ad2b0 (diff) | |
download | cpython-2b0d2007a1a51a15a67dc7297cf5e21c8767b563.zip cpython-2b0d2007a1a51a15a67dc7297cf5e21c8767b563.tar.gz cpython-2b0d2007a1a51a15a67dc7297cf5e21c8767b563.tar.bz2 |
Issue #23908: os functions now reject paths with embedded null character
on Windows instead of silently truncate them.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d45f59e..e538437 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -858,6 +858,11 @@ path_converter(PyObject *o, void *p) { Py_DECREF(unicode); return 0; } + if (wcslen(wide) != length) { + FORMAT_EXCEPTION(PyExc_TypeError, "embedded null character"); + Py_DECREF(unicode); + return 0; + } path->wide = wide; path->narrow = NULL; |