BugID:17132091: [WhiteScan] Fix buffer out of bounds error for rtl8711b I2CInitDat
@@ -281,6 +281,10 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
obj->I2Cx = I2C_DEV_TABLE[i2c_idx].I2Cx;
/* Set I2C Device Number */
+ if (obj->i2c_idx >= sizeof(I2CInitDat)) {
+ return;
+ }
+
I2CInitDat[obj->i2c_idx].I2CIdx = i2c_idx;
/* Load I2C default value */
