mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:13:01 +01:00
Fix an edge case when obtaining home directory.
Make the path to home directory empty before calling get_home_dir(), otherwise if the call fails, the contents are undefined.
This commit is contained in:
parent
a561ef8c49
commit
37b3b5a5ed
@ -210,6 +210,7 @@ static void complt_home_dir(ToxWindow *self, char *path, int pathsize, const cha
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
char homedir[MAX_STR_SIZE];
|
||||
homedir[0] = '\0';
|
||||
get_home_dir(homedir, sizeof(homedir));
|
||||
|
||||
char newline[MAX_STR_SIZE];
|
||||
|
@ -67,6 +67,7 @@ void get_home_dir(char *home, int size)
|
||||
char *get_user_config_dir(void)
|
||||
{
|
||||
char home[NSS_BUFLEN_PASSWD];
|
||||
home[0] = '\0';
|
||||
get_home_dir(home, sizeof(home));
|
||||
|
||||
char *user_config_dir;
|
||||
|
Loading…
Reference in New Issue
Block a user