From: Wook Song Date: Thu, 6 Jul 2017 04:20:34 +0000 (+0900) Subject: pass: parser: Remove hard-coded length of path strings in pass_conf_data X-Git-Tag: submit/tizen/20170710.060912~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31f78f91e8ef9f7bfbb0a93047aacec3d4d468e0;p=platform%2Fcore%2Fsystem%2Fpass.git pass: parser: Remove hard-coded length of path strings in pass_conf_data This patch removes the hard-coded length of character arrays, which indicates file paths, in the pass_conf_data structure. Change-Id: I3fd48d645560b004a7609a90a97fcf8d4cd3ec32 Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index 9d01ad2..1c0c161 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -495,14 +495,11 @@ static int pass_parse_resource_data(struct parse_result *result, else return -EINVAL; } else if (MATCH(result->name, "pass_res_name")) { - int len = strlen(result->value); - snprintf(conf_data->res_name, len + 1, "%s", result->value); + snprintf(conf_data->res_name, PASS_NAME_LEN, "%s", result->value); } else if (MATCH(result->name, "pass_path_conf_file")) { - int len = strlen(result->value); - snprintf(conf_data->path_conf_file, len + 1, "%s", result->value); + snprintf(conf_data->path_conf_file, PASS_NAME_LEN, "%s", result->value); } else if (MATCH(result->name, "pass_path_load_table")) { - int len = strlen(result->value); - snprintf(conf_data->path_load_table, len + 1, "%s", result->value); + snprintf(conf_data->path_load_table, PASS_NAME_LEN, "%s", result->value); } else if (MATCH(result->name, "pass_first_cpu")) { int pass_res_type = conf_data->res_type; diff --git a/src/pass/pass.h b/src/pass/pass.h index a606e4b..2d19cb9 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -277,9 +277,9 @@ struct pass_policy { */ struct pass_conf_data { unsigned int res_type; - char res_name[128]; - char path_conf_file[128]; - char path_load_table[128]; + char res_name[PASS_NAME_LEN]; + char path_conf_file[PASS_NAME_LEN]; + char path_load_table[PASS_NAME_LEN]; unsigned int num_cpus; unsigned int cpu;