Parcourir la source

fixed handling of hidden parameters

nullptr deref and not handled in mavlink
Andrew Tridgell il y a 3 ans
Parent
commit
aaa46146d9
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 1 1
      RemoteIDModule/DroneCAN.cpp
  2. 3 0
      RemoteIDModule/mavlink.cpp

+ 1 - 1
RemoteIDModule/DroneCAN.cpp

@@ -582,7 +582,7 @@ void DroneCAN::handle_param_getset(CanardInstance* ins, CanardRxTransfer* transf
     } else {
         vp = Parameters::find_by_index(req.index);
     }
-    if (vp->flags & PARAM_FLAG_HIDDEN) {
+    if (vp != nullptr && (vp->flags & PARAM_FLAG_HIDDEN)) {
         vp = nullptr;
     }
     if (vp != nullptr && req.name.len != 0 &&

+ 3 - 0
RemoteIDModule/mavlink.cpp

@@ -217,6 +217,9 @@ void MAVLinkSerial::process_packet(mavlink_status_t &status, mavlink_message_t &
         if (!p || !p->get_as_float(value)) {
             return;
         }
+        if (p != nullptr && (p->flags & PARAM_FLAG_HIDDEN)) {
+            return;
+        }
         mavlink_msg_param_value_send(chan,
                                      p->name, value,
                                      MAV_PARAM_TYPE_REAL32,