1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-30 05:43:28 +01:00

Merge pull request #291 from dantok/master

Fix some edge cases when obtaining paths
This commit is contained in:
JFreegman 2015-01-25 15:54:27 -05:00
commit 4badc983ea
3 changed files with 3 additions and 3 deletions

View File

@ -209,7 +209,7 @@ static void complt_home_dir(ToxWindow *self, char *path, int pathsize, const cha
{ {
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
char homedir[MAX_STR_SIZE]; char homedir[MAX_STR_SIZE] = {0};
get_home_dir(homedir, sizeof(homedir)); get_home_dir(homedir, sizeof(homedir));
char newline[MAX_STR_SIZE]; char newline[MAX_STR_SIZE];

View File

@ -66,7 +66,7 @@ void get_home_dir(char *home, int size)
*/ */
char *get_user_config_dir(void) char *get_user_config_dir(void)
{ {
char home[NSS_BUFLEN_PASSWD]; char home[NSS_BUFLEN_PASSWD] = {0};
get_home_dir(home, sizeof(home)); get_home_dir(home, sizeof(home));
char *user_config_dir; char *user_config_dir;

View File

@ -289,7 +289,7 @@ int settings_load(struct user_settings *s, const char *patharg)
if ( config_setting_lookup_string(setting, tox_strings.avatar_path, &str) ) { if ( config_setting_lookup_string(setting, tox_strings.avatar_path, &str) ) {
snprintf(s->avatar_path, sizeof(s->avatar_path), "%s", str); snprintf(s->avatar_path, sizeof(s->avatar_path), "%s", str);
int len = strlen(s->avatar_path); int len = strlen(str);
if (len >= sizeof(s->avatar_path)) if (len >= sizeof(s->avatar_path))
s->avatar_path[0] = '\0'; s->avatar_path[0] = '\0';