Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b46c6c1 authored by Myles Watson's avatar Myles Watson Committed by Martin Brabham
Browse files

Security: Send LinkKey reply without std::move

Bug: 162984360
Test: ./cert/run --host SecurityTest
Change-Id: Ib39682ff4e02af46396d7c133fb7b4faf72f8c16
parent a3bfa06c
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -150,16 +150,15 @@ void ClassicPairingHandler::OnReceive(hci::LinkKeyRequestView packet) {
  LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str());
  ASSERT_LOG(GetRecord()->GetPseudoAddress()->GetAddress() == packet.GetBdAddr(), "Address mismatch");
  if (GetRecord()->IsPaired()) {
    auto packet = hci::LinkKeyRequestReplyBuilder::Create(
        GetRecord()->GetPseudoAddress()->GetAddress(), GetRecord()->GetLinkKey());
    LOG_INFO("Sending: LINK_KEY_REQUEST_REPLY");
    this->GetChannel()->SendCommand(std::move(packet));
    this->GetChannel()->SendCommand(hci::LinkKeyRequestReplyBuilder::Create(
        GetRecord()->GetPseudoAddress()->GetAddress(), GetRecord()->GetLinkKey()));
    last_status_ = hci::ErrorCode::SUCCESS;
    Cancel();
  } else {
    auto packet = hci::LinkKeyRequestNegativeReplyBuilder::Create(GetRecord()->GetPseudoAddress()->GetAddress());
    LOG_INFO("Sending: LINK_KEY_REQUEST_NEGATIVE_REPLY");
    this->GetChannel()->SendCommand(std::move(packet));
    this->GetChannel()->SendCommand(
        hci::LinkKeyRequestNegativeReplyBuilder::Create(GetRecord()->GetPseudoAddress()->GetAddress()));
  }
}