Fix #98973: Renaming Custom Python Properties is Incorrect
PyUnicode_AsUTF8AndSize is used when renaming a custom python property, this method stores the size of the string without including the null terminator in the size. Renaming a custom python property now includes the null terminator when copying the new string name. Pull Request: https://projects.blender.org/blender/blender/pulls/107983
This commit is contained in:
committed by
Brecht Van Lommel
parent
c1d353c17b
commit
6948a2d613
@@ -261,12 +261,12 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS
|
||||
|
||||
name = PyUnicode_AsUTF8AndSize(value, &name_size);
|
||||
|
||||
if (name_size >= MAX_IDPROP_NAME) {
|
||||
if (name_size + 1 >= MAX_IDPROP_NAME) {
|
||||
PyErr_SetString(PyExc_TypeError, "string length cannot exceed 63 characters!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(self->prop->name, name, name_size);
|
||||
memcpy(self->prop->name, name, name_size + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user