dji_motor.c 中 sender_enable_flag 可能出现数组越界问题 #2

Open
opened 2024-07-11 16:47:27 +08:00 by sph · 0 comments
Owner

static uint8_t sender_enable_flag[6] = {0};

if (motor_id < 4)
{
motor_send_num = motor_id;
motor_grouping = config->can_handle == &hcan1 ? 6 : 8;
}
else
{
motor_send_num = motor_id - 4;
motor_grouping = config->can_handle == &hcan1 ? 7 : 9;
}
sender_enable_flag[motor_grouping] = 1; // 只要有电机注册到这个分组,置为1;在发送函数中会通过此标志判断是否有电机注册
sender_enable_flag定义长度为6,motor_grouping 赋值可能大于5

static uint8_t sender_enable_flag[6] = {0}; if (motor_id < 4) { motor_send_num = motor_id; motor_grouping = config->can_handle == &hcan1 ? 6 : 8; } else { motor_send_num = motor_id - 4; motor_grouping = config->can_handle == &hcan1 ? 7 : 9; } sender_enable_flag[motor_grouping] = 1; // 只要有电机注册到这个分组,置为1;在发送函数中会通过此标志判断是否有电机注册 sender_enable_flag定义长度为6,motor_grouping 赋值可能大于5
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: HFUT_Firmament_EC/basic_framework#2
No description provided.