Skip to content

Commit

Permalink
drivers: auxdisplay: jhd1313: fix Out-of-bounds read
Browse files Browse the repository at this point in the history
fix out of bounds read by doing the comparison with ARRAY_SIZE correctly

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
  • Loading branch information
jilaypandya authored and kartben committed Dec 20, 2024
1 parent b56aa0e commit 3202773
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/auxdisplay/auxdisplay_jhd1313.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static int auxdisplay_jhd1313_backlight_set(const struct device *dev, uint8_t co
const struct auxdisplay_jhd1313_config *config = dev->config;
struct auxdisplay_jhd1313_data *data = dev->data;

if (colour > ARRAY_SIZE(colour_define)) {
if (colour >= ARRAY_SIZE(colour_define)) {
LOG_WRN("Selected colour is too high a value");
return -EINVAL;
}
Expand Down

0 comments on commit 3202773

Please sign in to comment.