From 5a96d39542d356fc3d102d52390a55d8cb6758d3 Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 13 Nov 2018 15:12:31 +0200 Subject: Leave no string uninitialized. --- src/actionhelper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/actionhelper.c') diff --git a/src/actionhelper.c b/src/actionhelper.c index 93b3107..6cc37bd 100644 --- a/src/actionhelper.c +++ b/src/actionhelper.c @@ -36,7 +36,7 @@ void link_config(const AddOpt *opt, const char* newPath) { } int move_config(const AddOpt *opt, char *progDir, char *ret) { - char newPath[STR_L]; + char newPath[STR_L] = ""; char *tmp = strdup(opt->confPath); str_join_dirname_with_basename(newPath, progDir, basename(tmp)); free(tmp); @@ -106,9 +106,9 @@ void get_or_make_program_dir(const AddOpt *opt, const Conf *conf, char *ret) { } void add_make_link(const AddOpt *opt, const Conf *conf) { - char progDir[STR_L]; + char progDir[STR_L] = ""; get_or_make_program_dir(opt, conf, progDir); - char newPath[STR_L]; + char newPath[STR_L] = ""; move_config(opt, progDir, newPath); if (add_err_message(NULL)) { return; @@ -130,13 +130,13 @@ void edit_print_suggested_configs(DB *db, const char *pName) { } int init_create_config_file(UserOpt *opt) { - char absVCdir[STR_L]; + char absVCdir[STR_L] = ""; if (!util_file_exists(list_get_at(opt->args, 0), absVCdir)) { ERR("Version control directory: %s does not exist.", list_get_at(opt->args, 0)); return 1; } - char absSRdir[STR_L]; + char absSRdir[STR_L] = ""; if (!util_file_exists(list_get_at(opt->args, 1), absSRdir)) { ERR("Secret directory: %s does not exist.", list_get_at(opt->args, 1)); return 1; @@ -146,14 +146,14 @@ int init_create_config_file(UserOpt *opt) { util_mkdir(opt->confDir); } - char confName[STR_L]; + char confName[STR_L] = ""; make_config_name(confName, opt->confDir); FILE *f; if ((f = fopen(confName, "w")) == NULL) { return 1; } - char tmp[200]; + char tmp[STR_L] = ""; strcpy(tmp, "version_control_dir = "); strcat(tmp, absVCdir); strcat(tmp, "\n"); -- cgit v1.2.3