mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +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:
commit
7ab4af0427
6 changed files with 41 additions and 21 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue