mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 13:41:28 +00:00
Fix out-of-bound array access in T1000X Sensor (#4663)
if u8i == 135, then u8i++ runs, the loop exits since u8i == 136, then value for u8i is 136 after the for loop. then in the next line, ntc_res2[u8i] will read past the end of the array
This commit is contained in:
parent
dacb452d47
commit
e9d55de3cb
@ -95,7 +95,7 @@ float T1000xSensor::getTemp()
|
||||
|
||||
Vout = ntc_vot;
|
||||
Rt = (HEATER_NTC_RP * vcc_vot) / Vout - HEATER_NTC_RP;
|
||||
for (u8i = 0; u8i < 136; u8i++) {
|
||||
for (u8i = 0; u8i < 135; u8i++) {
|
||||
if (Rt >= ntc_res2[u8i]) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user