Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void rt_object_init(struct rt_object *object,
if(obj_name_len > RT_NAME_MAX - 1)
{
LOG_E("Object name %s exceeds RT_NAME_MAX=%d, consider increasing RT_NAME_MAX.", name, RT_NAME_MAX);
RT_ASSERT(obj_name_len <= RT_NAME_MAX - 1);
obj_name_len = RT_NAME_MAX - 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一句直接去掉就好了

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要@copilot才能修改哦

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新,使用 rt_strncpy 替代手动截断。Commit: 9a4f00c

Updated to use rt_strncpy instead of manual truncation. Commit: 9a4f00c

}
rt_memcpy(object->name, name, obj_name_len);
object->name[obj_name_len] = '\0';
Expand Down Expand Up @@ -515,7 +515,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
if(obj_name_len > RT_NAME_MAX - 1)
{
LOG_E("Object name %s exceeds RT_NAME_MAX=%d, consider increasing RT_NAME_MAX.", name, RT_NAME_MAX);
RT_ASSERT(obj_name_len <= RT_NAME_MAX - 1);
obj_name_len = RT_NAME_MAX - 1;
}
rt_memcpy(object->name, name, obj_name_len);
object->name[obj_name_len] = '\0';
Expand Down
Loading