From 47efa81c15f119d5a12ab8bff31e3846c00a6b2e Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 19 Dec 2024 23:03:56 +0100 Subject: [PATCH] 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 (cherry picked from commit 3202773b112c53c635985f7b7744544fe7fea4d8) --- drivers/auxdisplay/auxdisplay_jhd1313.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/auxdisplay/auxdisplay_jhd1313.c b/drivers/auxdisplay/auxdisplay_jhd1313.c index 9b4ef08e88b9..669c2653cd71 100644 --- a/drivers/auxdisplay/auxdisplay_jhd1313.c +++ b/drivers/auxdisplay/auxdisplay_jhd1313.c @@ -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; }