Skip to content

Commit 2a23479

Browse files
committed
Fix the crash issuse and Jira 752
1. Jira 752 BLE Central. Cannot detect local Name that is more than 8 characters 2. The construct function make program crash
1 parent d58d2c9 commit 2a23479

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libraries/BLE/src/BLECharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ BLECharacteristic::BLECharacteristic(const BLECharacteristic& rhs):
101101
_chrc_local_imp = NULL; // Not copy
102102
_value_size = rhs._value_size;
103103
_internal = rhs._internal;
104-
_bledev = BLEDevice(&rhs._bledev);
104+
_bledev.setAddress(*rhs._bledev.bt_le_address());
105105
memcpy(_uuid_cstr, rhs._uuid_cstr, sizeof(_uuid_cstr));
106106
_properties = rhs._properties;
107107

libraries/BLE/src/internal/BLEDeviceManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ void BLEDeviceManager::handleDeviceFound(const bt_addr_le_t *addr,
11891189
uint8_t data_len)
11901190
{
11911191
const uint8_t *data = ad;
1192+
uint8_t real_adv_len = data_len;
11921193

11931194
/* We're only interested in connectable events */
11941195
if (type == BT_LE_ADV_IND || type == BT_LE_ADV_DIRECT_IND)
@@ -1225,7 +1226,7 @@ void BLEDeviceManager::handleDeviceFound(const bt_addr_le_t *addr,
12251226
{
12261227
// The critical is accepted
12271228
// Find the oldest and expired buffer
1228-
if(false == setAdvertiseBuffer(addr, ad, data_len, rssi))
1229+
if(false == setAdvertiseBuffer(addr, ad, real_adv_len, rssi))
12291230
{
12301231
pr_info(LOG_MODULE_BLE, "No buffer to store the ADV\n");
12311232
}

0 commit comments

Comments
 (0)