summaryrefslogtreecommitdiff
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-20 09:53:58 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-20 09:53:58 +0300
commit446ca43cfdeb0c219464503a317644d10969e96e (patch)
tree0355cec71ea0d144ecda924ca21eceb72f7218a0 /Modules/posixmodule.c
parent52396c55dfee13021d5d557db7754a986b259642 (diff)
downloadcpython-446ca43cfdeb0c219464503a317644d10969e96e.tar.gz
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.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index d45f59e5f1..e538437941 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;