Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.

Patch by Hynek Schlawack.
This commit is contained in:
Antoine Pitrou 2012-01-29 18:43:36 +01:00
commit 7ab4af0427
6 changed files with 41 additions and 21 deletions

View file

@ -3574,6 +3574,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)
{