guard against ADC buffer overrun (#1812)
This commit is contained in:
parent
fccf0576bb
commit
2ee9e837bb
|
@ -346,6 +346,11 @@ bool AdcDevice::isHwUsed(adc_channel_e hwChannelIndex) const {
|
|||
}
|
||||
|
||||
void AdcDevice::enableChannel(adc_channel_e hwChannel) {
|
||||
if (channelCount >= efi::size(values.adc_data)) {
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Too many ADC channels configured");
|
||||
return;
|
||||
}
|
||||
|
||||
int logicChannel = channelCount++;
|
||||
|
||||
size_t channelAdcIndex = hwChannel - 1;
|
||||
|
|
Loading…
Reference in New Issue