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

Commit d5135903 authored by Srinu Jella's avatar Srinu Jella Committed by Jakub Pawlowski
Browse files

Saving Bluetooth name to Max 248 character only.

Steps:
1. Set the BT name more than 248 character using SDK API set_name.
2. Check the BT Name on bt_config.
3. Name should be also visible Setting Apps on Bluetooth.

Failure: BluetoothAdapterProperties and stack are not in sync.
Root Cause: No check for the Bluetooth name length.
We can handle in framework layer but now handling in Stack.

Fix: Check the length of Bluetooth Name before writing to the file.

Test: Application and Stack BD Name are in sync
Bug: 35126970

Change-Id: I856a66e863cec68bee38762903a0b762ab0626d2
parent 32af88b6
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -200,14 +200,18 @@ static int prop2cfg(const RawAddress* remote_bd_addr, bt_property_t* prop) {
      btif_config_set_int(bdstr, BTIF_STORAGE_PATH_REMOTE_DEVTIME,
                          (int)time(NULL));
      break;
    case BT_PROPERTY_BDNAME:
      strncpy(value, (char*)prop->val, prop->len);
      value[prop->len] = '\0';
    case BT_PROPERTY_BDNAME: {
      int name_length = prop->len > BTM_MAX_LOC_BD_NAME_LEN
                            ? BTM_MAX_LOC_BD_NAME_LEN
                            : prop->len;
      strncpy(value, (char*)prop->val, name_length);
      value[name_length] = '\0';
      if (remote_bd_addr)
        btif_config_set_str(bdstr, BTIF_STORAGE_PATH_REMOTE_NAME, value);
      else
        btif_config_set_str("Adapter", BTIF_STORAGE_KEY_ADAPTER_NAME, value);
      break;
    }
    case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
      strncpy(value, (char*)prop->val, prop->len);
      value[prop->len] = '\0';