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

Commit 60be91a7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "SecurityManager: Don't access packet after move()"

parents 0d4cf678 011c91e5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -157,17 +157,19 @@ void SecurityManagerImpl::HandleEvent(T packet) {
  if (entry != pairing_handler_map_.end()) {
    entry->second->OnReceive(packet);
  } else {
    auto bd_addr = packet.GetBdAddr();
    auto event_code = packet.GetEventCode();
    auto event = hci::EventPacketView::Create(std::move(packet));
    ASSERT_LOG(event.IsValid(), "Received invalid packet");
    const hci::EventCode code = event.GetEventCode();
    auto record = CreateSecurityRecord(packet.GetBdAddr());
    auto record = CreateSecurityRecord(bd_addr);
    switch (code) {
      case hci::EventCode::LINK_KEY_REQUEST:
        DispatchPairingHandler(record, true);
        break;
      default:
        LOG_ERROR("No classic pairing handler for device '%s' ready for command '%hhx' ",
                  packet.GetBdAddr().ToString().c_str(), packet.GetEventCode());
        LOG_ERROR("No classic pairing handler for device '%s' ready for command '%hhx' ", bd_addr.ToString().c_str(),
                  event_code);
        break;
    }
  }