mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
c875d2032b
commit
1334884ff2
7 changed files with 44 additions and 22 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue