Skip to content

Commit f0814e6

Browse files
authored
Merge pull request #771 from RubenKelevra/bugfix/sccb-max-devices-oob
sccb-ng: fix off-by-one device capacity check to prevent overflow
2 parents 69737c5 + 05decdb commit f0814e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

driver/sccb-ng.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int SCCB_Install_Device(uint8_t slv_addr)
8080
esp_err_t ret;
8181
i2c_master_bus_handle_t bus_handle;
8282

83-
if (device_count > MAX_DEVICES)
83+
if (device_count >= MAX_DEVICES)
8484
{
8585
ESP_LOGE(TAG, "cannot add more than %d devices", MAX_DEVICES);
8686
return ESP_FAIL;

0 commit comments

Comments
 (0)