Fix the svace issue 44/103044/3
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 7 Dec 2016 06:10:52 +0000 (15:10 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 7 Dec 2016 06:15:31 +0000 (15:15 +0900)
Change-Id: I948e2fd37ce2a881bf81996197c11e3f275463a5
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/bluetooth-common.c
test/bt_unit_test.c

index 9e284995f90854aeb31fd4c85817a581229902a2..16abff5835f50676527bbf78c0a19decf0c90a7e 100644 (file)
@@ -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;
index cbb3c31cebc6bf6941df77b5f236de0a81e30979..0cc131a64c27d61d1377385dbdc6b7f7f7d2aa06 100644 (file)
@@ -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) {