Browse Source

Fixed buffer overflow with auth key

QGC4.4
Lorenz Meier 13 years ago
parent
commit
e375bfe101
  1. 4
      src/comm/MAVLinkProtocol.cc

4
src/comm/MAVLinkProtocol.cc

@ -539,8 +539,8 @@ void MAVLinkProtocol::sendHeartbeat() @@ -539,8 +539,8 @@ void MAVLinkProtocol::sendHeartbeat()
{
mavlink_message_t msg;
mavlink_auth_key_t auth;
if (m_authKey.length() != MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN) m_authKey.resize(MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN);
strcpy(auth.key, m_authKey.toStdString().c_str());
memset(auth, 0, sizeof(auth));
memcpy(auth.key, m_authKey.toStdString().c_str(), qMin(m_authKey.length(), MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN));
mavlink_msg_auth_key_encode(getSystemId(), getComponentId(), &msg, &auth);
sendMessage(msg);
}

Loading…
Cancel
Save