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;
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) {
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) {
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) {