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

Commit a859f995 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "btm: fixing oob write in multi-adv SetData." into qt-qpr1-dev

parents 868233c0 246f4b06
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -728,17 +728,14 @@ class BleAdvertisingManagerImpl
      data.insert(data.begin(), flags.begin(), flags.end());
    }

    // Find and fill TX Power with the correct value
    if (data.size()) {
      size_t i = 0;
      while (i < data.size()) {
        uint8_t type = data[i + 1];
        if (type == HCI_EIR_TX_POWER_LEVEL_TYPE) {
    // Find and fill TX Power with the correct value.
    // The TX Power section is a 3 byte section.
    for (size_t i = 0; (i + 2) < data.size();) {
      if (data[i + 1] == HCI_EIR_TX_POWER_LEVEL_TYPE) {
        data[i + 2] = adv_inst[inst_id].tx_power;
      }
      i += data[i] + 1;
    }
    }

    VLOG(1) << "data is: " << base::HexEncode(data.data(), data.size());
    DivideAndSendData(