AP_HAL_Linux: [Bugfix] prevent memory acces violation in process_dsm_pulse

When a S.Bus signal is fed into the rcin-Pin AruPlane on the BBB get's a
Segmentation fault. This patch prevents the memory acces to dsm_state.bytes[16] outside
of the array bounds. The patch should be reviewed by sombody who knows the DSM protocol,
as i don't.
This commit is contained in:
Alexander Mergel 2014-10-27 21:17:17 +01:00 committed by Andrew Tridgell
parent 05b903654e
commit 14c401c0f4

View File

@ -249,6 +249,11 @@ void LinuxRCInput::_process_dsm_pulse(uint16_t width_s0, uint16_t width_s1)
byte_ofs = dsm_state.bit_ofs/10; byte_ofs = dsm_state.bit_ofs/10;
bit_ofs = dsm_state.bit_ofs%10; bit_ofs = dsm_state.bit_ofs%10;
if(byte_ofs > 15) {
// invalid data
goto reset;
}
// pull in the high bits // pull in the high bits
nbits = bits_s0; nbits = bits_s0;