From: DoHyun Pyun Date: Wed, 7 Dec 2016 06:10:52 +0000 (+0900) Subject: Fix the svace issue X-Git-Tag: submit/tizen_3.0/20161208.051813~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F103044%2F3;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the svace issue Change-Id: I948e2fd37ce2a881bf81996197c11e3f275463a5 Signed-off-by: DoHyun Pyun --- 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) {