Skip to content

Commit

Permalink
Merge pull request #149 from dmipx/d4xx-kw-fix-jp5
Browse files Browse the repository at this point in the history
d4xx: fix kw array out-of-bound issue.
  • Loading branch information
dmipx authored Jan 15, 2023
2 parents 8e3cb7c + 0daa34c commit 83166f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ static const char *ds5_get_sensor_name(struct ds5 *state)
static const char *sensor_name[] = {"unknown", "RGB", "DEPTH", "Y8", "IMU"};
int sensor_id = state->is_rgb * 1 + state->is_depth * 2 + \
state->is_y8 * 3 + state->is_imu * 4;
if (sensor_id > (sizeof(sensor_name)/sizeof(*sensor_name)))
if (sensor_id >= (sizeof(sensor_name)/sizeof(*sensor_name)))
sensor_id = 0;

return sensor_name[sensor_id];
Expand Down

0 comments on commit 83166f3

Please sign in to comment.