From e24785204385ed82e17d4161e4b04e4cd76523b5 Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Fri, 1 Mar 2019 10:46:59 +0000 Subject: [PATCH] reinstate fixes --- .../stack/ble-host/sources/stack/cfg/cfg_stack.h | 4 ++-- .../TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.c | 4 ++-- .../TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.h | 4 ++-- .../TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv_ae.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/cfg/cfg_stack.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/cfg/cfg_stack.h index 1c6a358f9e2..319a40d6bab 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/cfg/cfg_stack.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/cfg/cfg_stack.h @@ -86,13 +86,13 @@ extern "C" { /*! \brief Number of supported advertising sets: must be set to 1 for legacy advertising */ #ifndef DM_NUM_ADV_SETS -#define DM_NUM_ADV_SETS 1 +#define DM_NUM_ADV_SETS 3 #endif /*! \brief Number of scanner and initiator PHYs (LE 1M, LE 2M and LE Coded): must be set to 1 for legacy scanner and initiator */ #ifndef DM_NUM_PHYS -#define DM_NUM_PHYS 1 +#define DM_NUM_PHYS 3 #endif /**@}*/ diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.c b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.c index 581726180ee..7ca30c6721b 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.c +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.c @@ -153,14 +153,14 @@ void DmAdvSetData(uint8_t advHandle, uint8_t op, uint8_t location, uint8_t len, WSF_ASSERT((location == DM_DATA_LOC_SCAN) || (location == DM_DATA_LOC_ADV)); WSF_ASSERT(advHandle < DM_NUM_ADV_SETS); - if ((pMsg = WsfMsgAlloc(sizeof(dmAdvApiSetData_t))) != NULL) + if ((pMsg = WsfMsgAlloc(sizeof(dmAdvApiSetData_t) + len)) != NULL) { pMsg->hdr.event = DM_ADV_MSG_API_SET_DATA; pMsg->advHandle = advHandle; pMsg->op = op; pMsg->location = location; pMsg->len = len; - pMsg->pData = pData; + memcpy(pMsg->pData, pData, len); WsfMsgSend(dmCb.handlerId, pMsg); } } diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.h index 70d59d794d6..22696a5c63d 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv.h @@ -101,7 +101,7 @@ typedef struct uint8_t op; uint8_t location; uint8_t len; - uint8_t *pData; + uint8_t pData[]; } dmAdvApiSetData_t; /* Data structure for DM_ADV_MSG_API_START */ @@ -151,7 +151,7 @@ typedef struct uint8_t advHandle; uint8_t op; uint8_t len; - uint8_t *pData; + uint8_t pData[]; } dmAdvPerApiSetData_t; /* Data structure for DM_ADV_PER_MSG_API_START */ diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv_ae.c b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv_ae.c index 2fb708fbd59..9f3b36c1144 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv_ae.c +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/ble-host/sources/stack/dm/dm_adv_ae.c @@ -1660,13 +1660,13 @@ void DmPerAdvSetData(uint8_t advHandle, uint8_t op, uint8_t len, uint8_t *pData) WSF_ASSERT(advHandle < DM_NUM_ADV_SETS); WSF_ASSERT(len <= HCI_PER_ADV_DATA_LEN); - if ((pMsg = WsfMsgAlloc(sizeof(dmAdvPerApiSetData_t))) != NULL) + if ((pMsg = WsfMsgAlloc(sizeof(dmAdvPerApiSetData_t) + len)) != NULL) { pMsg->hdr.event = DM_ADV_PER_MSG_API_SET_DATA; pMsg->advHandle = advHandle; pMsg->op = op; pMsg->len = len; - pMsg->pData = pData; + memcpy(pMsg->pData, pData, len); WsfMsgSend(dmCb.handlerId, pMsg); } }