Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/console/dlt-control-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,8 @@ DltReturnValue dlt_json_filter_save(DltFilter *filter, const char *filename, int

for (int num = 0; num < filter->counter; num++) {
struct json_object *tmp_json_obj = json_object_new_object();
char filter_name[JSON_FILTER_NAME_SIZE];
sprintf(filter_name, "filter%i", num);
char filter_name[JSON_FILTER_NAME_SIZE + 1];
snprintf(filter_name, sizeof(filter_name), "filter%i", num);

if (filter->apid[num][DLT_ID_SIZE - 1] != 0)
json_object_object_add(tmp_json_obj, "AppId", json_object_new_string_len(filter->apid[num], DLT_ID_SIZE));
Expand All @@ -919,7 +919,7 @@ DltReturnValue dlt_json_filter_save(DltFilter *filter, const char *filename, int
}

printf("Saving current filter into '%s'\n", filename);
json_object_to_file((char*)filename, json_filter_obj);
json_object_to_file(filename, json_filter_obj);

return DLT_RETURN_OK;
}
Expand All @@ -941,8 +941,8 @@ DltReturnValue dlt_json_filter_save(DltFilter *filter, const char *filename, int
json_encoder_start_object(j_encoder, NULL);

for (int num = 0; num < filter->counter; num++) {
char filter_name[JSON_FILTER_NAME_SIZE];
sprintf(filter_name, "filter%i", num);
char filter_name[JSON_FILTER_NAME_SIZE + 1];
snprintf(filter_name, sizeof(filter_name), "filter%i", num);
json_encoder_start_object(j_encoder, filter_name);

strncpy(s_app_id, filter->apid[num], DLT_ID_SIZE);
Expand Down