HAL_SITL: prevent array overruns in RCInput/RCOutput
This commit is contained in:
parent
ed099a73a3
commit
a566ebe4ec
@ -18,6 +18,9 @@ bool SITLRCInput::new_input() {
|
||||
|
||||
uint16_t SITLRCInput::read(uint8_t ch) {
|
||||
_sitlState->new_rc_input = false;
|
||||
if (ch >= 8) {
|
||||
return 0;
|
||||
}
|
||||
return _override[ch]? _override[ch] : _sitlState->pwm_input[ch];
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,9 @@ void SITLRCOutput::disable_ch(uint8_t ch)
|
||||
|
||||
void SITLRCOutput::write(uint8_t ch, uint16_t period_us)
|
||||
{
|
||||
if (ch < 11) {
|
||||
_sitlState->pwm_output[ch] = period_us;
|
||||
}
|
||||
}
|
||||
|
||||
void SITLRCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len)
|
||||
@ -31,8 +33,12 @@ void SITLRCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len)
|
||||
memcpy(_sitlState->pwm_output+ch, period_us, len*sizeof(uint16_t));
|
||||
}
|
||||
|
||||
uint16_t SITLRCOutput::read(uint8_t ch) {
|
||||
uint16_t SITLRCOutput::read(uint8_t ch)
|
||||
{
|
||||
if (ch < 11) {
|
||||
return _sitlState->pwm_output[ch];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SITLRCOutput::read(uint16_t* period_us, uint8_t len)
|
||||
|
Loading…
Reference in New Issue
Block a user