diff options
Diffstat (limited to 'Python/crossinterp.c')
-rw-r--r-- | Python/crossinterp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/crossinterp.c b/Python/crossinterp.c index 7aaa045f375..0a106ad636b 100644 --- a/Python/crossinterp.c +++ b/Python/crossinterp.c @@ -342,6 +342,11 @@ _copy_string_obj_raw(PyObject *strobj, Py_ssize_t *p_size) return NULL; } + if (size != (Py_ssize_t)strlen(str)) { + PyErr_SetString(PyExc_ValueError, "found embedded NULL character"); + return NULL; + } + char *copied = PyMem_RawMalloc(size+1); if (copied == NULL) { PyErr_NoMemory(); |