pass: parser: Remove hard-coded length of path strings in pass_conf_data 54/137454/7
authorWook Song <wook16.song@samsung.com>
Thu, 6 Jul 2017 04:20:34 +0000 (13:20 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Jul 2017 05:48:26 +0000 (05:48 +0000)
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 <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-parser.c
src/pass/pass.h

index 9d01ad20b5eb85bc8789d4185d9665b9ea88e740..1c0c1618ce0da18a796a389b2d17ccea7e158b03 100644 (file)
@@ -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;
 
index a606e4bd70b8455edcfc2ef16e431c0c13660f84..2d19cb99444dfb3816100154c3f5f3ff72657206 100644 (file)
@@ -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;