diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-07 09:25:04 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-07 09:38:55 +0100 |
commit | 43023fa51913b5f15a7e33275e3787c46ff74cc1 (patch) | |
tree | 8a24b6b42896b713bf02150010d4680c0d0a3b48 | |
parent | e522dd1a68d559f43a337e862f9f0a4d233d9272 (diff) | |
download | subsurface-43023fa51913b5f15a7e33275e3787c46ff74cc1.tar.gz |
0 initialize strings
Otherwise bad things happen when you strcat into them. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | linux.c | 2 | ||||
-rw-r--r-- | macos.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -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"); } @@ -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"); } |