From 3507fc02797e39493cc6c115a3a228396c99cc11 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Wed, 7 Dec 2016 15:10:52 +0900 Subject: [PATCH] Fix the svace issue Change-Id: I948e2fd37ce2a881bf81996197c11e3f275463a5 Signed-off-by: DoHyun Pyun --- src/bluetooth-common.c | 4 ++++ test/bt_unit_test.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 9e28499..16abff5 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -2125,6 +2125,10 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us for (char_list = svc->characteristics; char_list; char_list = g_slist_next(char_list)) { bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)char_list->data; + + if (chr == NULL) + continue; + if (chr->path && strcmp(char_val->char_handle, chr->path) == 0) { g_free(chr->value); chr->value = NULL; diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index cbb3c31..0cc131a 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -3395,7 +3395,7 @@ int test_set_params(int test_id, char *param) g_test_param.params[param_index - 1] = g_malloc0(len + 1); /* Remove new line character */ param[len - 1] = '\0'; - strcpy(g_test_param.params[param_index - 1], param); + strncpy(g_test_param.params[param_index - 1], param, strlen(param)); } if (param_index == g_test_param.param_count) { @@ -3425,7 +3425,7 @@ int test_set_params(int test_id, char *param) g_test_param.params[param_index - 1] = g_malloc0(len + 1); /* Remove new line character */ param[len - 1] = '\0'; - strcpy(g_test_param.params[param_index - 1], param); + strncpy(g_test_param.params[param_index - 1], param, strlen(param)); } if (param_index == g_test_param.param_count) { @@ -4493,7 +4493,7 @@ int test_set_params(int test_id, char *param) g_test_param.params[param_index - 1] = g_malloc0(len + 1); /* Remove new line character */ param[len - 1] = '\0'; - strcpy(g_test_param.params[param_index - 1], param); + strncpy(g_test_param.params[param_index - 1], param, strlen(param)); } if (param_index == g_test_param.param_count) { -- 2.34.1