0 initialize strings

Otherwise bad things happen when you strcat into them. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-07 09:25:04 +01:00
parent e522dd1a68
commit 43023fa519
2 changed files with 2 additions and 2 deletions

View file

@ -86,7 +86,7 @@ const char *system_default_filename(void)
const char *user = getenv("LOGNAME");
if (same_string(user, ""))
user = "username";
filename = malloc(strlen(user) + 5);
filename = calloc(strlen(user) + 5, 1);
strcat(filename, user);
strcat(filename, ".xml");
}

View file

@ -79,7 +79,7 @@ const char *system_default_filename(void)
const char *user = getenv("LOGNAME");
if (same_string(user, ""))
user = "username";
filename = malloc(strlen(user) + 5);
filename = calloc(strlen(user) + 5, 1);
strcat(filename, user);
strcat(filename, ".xml");
}