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 <jilay.pandya@outlook.com>
This commit is contained in:
parent
b56aa0e823
commit
3202773b11
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
const struct auxdisplay_jhd1313_config *config = dev->config;
|
||||||
struct auxdisplay_jhd1313_data *data = dev->data;
|
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");
|
LOG_WRN("Selected colour is too high a value");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue