Browse Source

GCS_MAVLink: check the signing key magic on load

or we end up with a bad key when MAVLink2 is first enabled
mission-4.1.18
Andrew Tridgell 9 years ago
parent
commit
cfd7268bd5
  1. 8
      libraries/GCS_MAVLink/GCS_Signing.cpp

8
libraries/GCS_MAVLink/GCS_Signing.cpp

@ -53,7 +53,13 @@ bool GCS_MAVLINK::signing_key_load(struct SigningKey &key) @@ -53,7 +53,13 @@ bool GCS_MAVLINK::signing_key_load(struct SigningKey &key)
if (_signing_storage.size() < sizeof(key)) {
return false;
}
return _signing_storage.read_block(&key, 0, sizeof(key));
if (!_signing_storage.read_block(&key, 0, sizeof(key))) {
return false;
}
if (key.magic != SIGNING_KEY_MAGIC) {
return false;
}
return true;
}
/*

Loading…
Cancel
Save