diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-01 20:34:44 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-01 20:34:44 (GMT) |
| commit | 3c9ce74c218703ed75a11f71ed215559fa0c4257 (patch) | |
| tree | d15e279a54aeacd6cf92e27d05b5c4708e699121 /Objects/fileobject.c | |
| parent | 3626e5ef2acfa10a5badfa77989c9718faaf790d (diff) | |
| download | cpython-3c9ce74c218703ed75a11f71ed215559fa0c4257.zip cpython-3c9ce74c218703ed75a11f71ed215559fa0c4257.tar.gz cpython-3c9ce74c218703ed75a11f71ed215559fa0c4257.tar.bz2 | |
Issue #23908: os functions, open() and the io.FileIO constructor now reject
unicode paths with embedded null character on Windows instead of silently
truncate them.
Diffstat (limited to 'Objects/fileobject.c')
| -rw-r--r-- | Objects/fileobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index b29da8a..a7d64ba 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -2394,7 +2394,8 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds) #ifdef MS_WINDOWS if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file", - kwlist, &po, &mode, &bufsize)) { + kwlist, &po, &mode, &bufsize) && + wcslen(PyUnicode_AS_UNICODE(po)) == (size_t)PyUnicode_GET_SIZE(po)) { wideargument = 1; if (fill_file_fields(foself, NULL, po, mode, fclose) == NULL) |
