diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-29 17:43:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-29 17:43:36 (GMT) |
commit | 7ab4af0427a100e1054dea6137381c5dbf843530 (patch) | |
tree | 5675c8aba99f23694645917896e81ce877263d20 /Objects | |
parent | cdc878e56298c9da9720f1298a8b780a189ce029 (diff) | |
parent | 1334884ff2f5a3968e6a26157f869b4ca5de189b (diff) | |
download | cpython-7ab4af0427a100e1054dea6137381c5dbf843530.zip cpython-7ab4af0427a100e1054dea6137381c5dbf843530.tar.gz cpython-7ab4af0427a100e1054dea6137381c5dbf843530.tar.bz2 |
Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 648d9a0..67336bf 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3575,6 +3575,19 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size) int +_PyUnicode_HasNULChars(PyObject* s) +{ + static PyObject *nul = NULL; + + if (nul == NULL) + nul = PyUnicode_FromStringAndSize("\0", 1); + if (nul == NULL) + return -1; + return PyUnicode_Contains(s, nul); +} + + +int PyUnicode_FSConverter(PyObject* arg, void* addr) { PyObject *output = NULL; |