mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
e522dd1a68
commit
43023fa519
2 changed files with 2 additions and 2 deletions
2
linux.c
2
linux.c
|
@ -86,7 +86,7 @@ const char *system_default_filename(void)
|
||||||
const char *user = getenv("LOGNAME");
|
const char *user = getenv("LOGNAME");
|
||||||
if (same_string(user, ""))
|
if (same_string(user, ""))
|
||||||
user = "username";
|
user = "username";
|
||||||
filename = malloc(strlen(user) + 5);
|
filename = calloc(strlen(user) + 5, 1);
|
||||||
strcat(filename, user);
|
strcat(filename, user);
|
||||||
strcat(filename, ".xml");
|
strcat(filename, ".xml");
|
||||||
}
|
}
|
||||||
|
|
2
macos.c
2
macos.c
|
@ -79,7 +79,7 @@ const char *system_default_filename(void)
|
||||||
const char *user = getenv("LOGNAME");
|
const char *user = getenv("LOGNAME");
|
||||||
if (same_string(user, ""))
|
if (same_string(user, ""))
|
||||||
user = "username";
|
user = "username";
|
||||||
filename = malloc(strlen(user) + 5);
|
filename = calloc(strlen(user) + 5, 1);
|
||||||
strcat(filename, user);
|
strcat(filename, user);
|
||||||
strcat(filename, ".xml");
|
strcat(filename, ".xml");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue