Commit 5557a9c7 authored by Christian Heimes's avatar Christian Heimes

Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR....

Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815
parent 2fd8bdbc
......@@ -254,12 +254,8 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
char *string;
Py_ssize_t len;
if (!PyUnicode_Check(v)) {
PyErr_BadArgument();
return -1;
}
string = _PyUnicode_AsStringAndSize(v, &len);
if (len != 1) {
if (string == NULL || len != 1) {
PyErr_BadArgument();
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment