aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-11-20 17:00:02 +1100
committerAndrew Tridgell <tridge@samba.org>2014-11-26 08:32:47 +1100
commit8e44ec2e3bd6852b74e4463c373555dd1bab47d3 (patch)
tree7bc4438690f76341192809bdd375a37c10b1eaf8 /src
parentead0458e97d6e19cc0b188124063e90962820e3a (diff)
downloadpx4-firmware-8e44ec2e3bd6852b74e4463c373555dd1bab47d3.tar.gz
px4-firmware-8e44ec2e3bd6852b74e4463c373555dd1bab47d3.tar.bz2
px4-firmware-8e44ec2e3bd6852b74e4463c373555dd1bab47d3.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/modules/uavcan/actuators/esc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/modules/uavcan/actuators/esc.cpp b/src/modules/uavcan/actuators/esc.cpp
index 7efd50511..9f682c7e1 100644
--- a/src/modules/uavcan/actuators/esc.cpp
+++ b/src/modules/uavcan/actuators/esc.cpp
@@ -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;
}