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:36:34 +01:00
parent c875d2032b
commit 1334884ff2
7 changed files with 44 additions and 22 deletions

View file

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