summaryrefslogtreecommitdiff
path: root/android/hal-health.c
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2014-04-22 15:06:01 +0300
committerSzymon Janc <szymon.janc@tieto.com>2014-04-23 21:59:16 +0200
commit993485b0555a210be82332c4398f63258d337632 (patch)
tree4dbd7287a02b138614f3ce697878f66bab8fc9c2 /android/hal-health.c
parent80baeb02f1857ac92099ac415c1e7eb0b67914c5 (diff)
downloadbluez-993485b0555a210be82332c4398f63258d337632.tar.gz
android/hal-health: Fix copying empty string
MDEP desciption is optional. So check before copying.
Diffstat (limited to 'android/hal-health.c')
-rw-r--r--android/hal-health.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/android/hal-health.c b/android/hal-health.c
index 4ba6fe776..b92c8812a 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -101,9 +101,13 @@ static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
mdep->role = reg->mdep_cfg[i].mdep_role;
mdep->data_type = reg->mdep_cfg[i].data_type;
mdep->channel_type = reg->mdep_cfg[i].channel_type;
- mdep->descr_len = strlen(reg->mdep_cfg[i].mdep_description) + 1;
- memcpy(mdep->descr, reg->mdep_cfg[i].mdep_description,
+
+ if (reg->mdep_cfg[i].mdep_description) {
+ mdep->descr_len =
+ strlen(reg->mdep_cfg[i].mdep_description) + 1;
+ memcpy(mdep->descr, reg->mdep_cfg[i].mdep_description,
mdep->descr_len);
+ }
status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_MDEP,
sizeof(*mdep) + mdep->descr_len,