uavcan: prevent crash in ESC driver

passing in more than 8 actuators would crash the ESC driver. We need
to check again the array size of the _esc_status.esc, which is
CONNECTED_ESC_MAX
This commit is contained in:
Andrew Tridgell
2014-11-20 17:00:02 +11:00
parent ead0458e97
commit 8e44ec2e3b
+3 -1
View File
@@ -76,7 +76,9 @@ int UavcanEscController::init()
void UavcanEscController::update_outputs(float *outputs, unsigned num_outputs)
{
if ((outputs == nullptr) || (num_outputs > uavcan::equipment::esc::RawCommand::FieldTypes::cmd::MaxSize)) {
if ((outputs == nullptr) ||
(num_outputs > uavcan::equipment::esc::RawCommand::FieldTypes::cmd::MaxSize) ||
(num_outputs > CONNECTED_ESC_MAX)) {
perf_count(_perfcnt_invalid_input);
return;
}