Skip to content

Commit 17df0f1

Browse files
jilaypandyadkalowsk
authored andcommitted
drivers: auxdisplay: jhd1313: fix Out-of-bounds read
fix out of bounds read by doing the comparison with ARRAY_SIZE correctly Signed-off-by: Jilay Pandya <[email protected]> (cherry picked from commit 3202773)
1 parent d6ec225 commit 17df0f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/auxdisplay/auxdisplay_jhd1313.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static int auxdisplay_jhd1313_backlight_set(const struct device *dev, uint8_t co
205205
const struct auxdisplay_jhd1313_config *config = dev->config;
206206
struct auxdisplay_jhd1313_data *data = dev->data;
207207

208-
if (colour > ARRAY_SIZE(colour_define)) {
208+
if (colour >= ARRAY_SIZE(colour_define)) {
209209
LOG_WRN("Selected colour is too high a value");
210210
return -EINVAL;
211211
}

0 commit comments

Comments
 (0)