Fix #98973: Renaming Custom Python Properties is Incorrect #107983

Manually merged
Brecht Van Lommel merged 1 commits from guishe/blender:rename-property into main 2023-06-13 19:55:15 +02:00
1 changed files with 1 additions and 1 deletions
Showing only changes of commit 72c49f8c11 - Show all commits

View File

@ -266,7 +266,7 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS
return -1;
brecht marked this conversation as resolved

The these here should add + 1 as well then, I can fix that as part of the commit.

The these here should add + 1 as well then, I can fix that as part of the commit.

I think not, name_size don t count the null terminator, so we can have up to 63 characters and character 64 can be '\0'

  if (name_size >= MAX_IDPROP_NAME) {
    PyErr_SetString(PyExc_TypeError, "string length cannot exceed 63 characters!");
    return -1;
  }

  memcpy(self->prop->name, name, name_size + 1);
  return 0;
}

if the check was if (name_size + 1 > MAX_IDPROP_NAME) { , so there yes

I think not, `name_size` don t count the null terminator, so we can have up to 63 characters and character 64 can be '\0' ```cpp if (name_size >= MAX_IDPROP_NAME) { PyErr_SetString(PyExc_TypeError, "string length cannot exceed 63 characters!"); return -1; } memcpy(self->prop->name, name, name_size + 1); return 0; } ``` if the check was `if (name_size + 1 > MAX_IDPROP_NAME) { `, so there yes

You're right, fixed now in f3c45f5b5a.

You're right, fixed now in f3c45f5b5ab35cffcda3cb03744958e8fc541c66.

@brecht can you take a second look?

edit: I saw now you message

@brecht can you take a second look? edit: I saw now you message
}
memcpy(self->prop->name, name, name_size);
memcpy(self->prop->name, name, name_size + 1);
return 0;
}