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

Commit 0707fa05 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Reject random addresses that are empty"

parents d6c3e1a1 80a40bb6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -247,9 +247,17 @@ ErrorCode LinkLayerController::LeSetRandomAddress(Address random_address) {
  // the Controller shall return the error code Command Disallowed (0x0C).
  if (legacy_advertiser_.IsEnabled() || scanner_.IsEnabled() ||
      initiator_.IsEnabled()) {
    LOG_INFO("advertising, scanning or initiating are currently active");
    return ErrorCode::COMMAND_DISALLOWED;
  }

  if (random_address == Address::kEmpty) {
    LOG_INFO("the random address may not be set to 00:00:00:00:00:00");
    return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
  }

  LOG_INFO("device random address configured to %s",
           random_address.ToString().c_str());
  random_address_ = random_address;
  return ErrorCode::SUCCESS;
}