Use xstrdup instead of static memory assignment to avoid a problem when we try to free

The original code had host file entries pointing to static memory.  This
memory is freed in tilde_expand_paths.  Better to xstrdup like the
original openssh code did.
This commit is contained in:
dkulwin 2015-11-04 18:30:33 -06:00
parent 319d1bb581
commit c2c272eaf1

View File

@ -1895,13 +1895,13 @@ void fill_default_options(Options * options, struct passwd *pw)
if (options->num_user_hostfiles == 0) {
options->user_hostfiles[options->num_user_hostfiles++] =
#ifdef WIN32_FIXME
user_hostfile_name ;
xstrdup(user_hostfile_name);
#else
xstrdup(_PATH_SSH_USER_HOSTFILE);
#endif
options->user_hostfiles[options->num_user_hostfiles++] =
#ifdef WIN32_FIXME
user_hostfile_name2 ;
xstrdup(user_hostfile_name2);
#else
xstrdup(_PATH_SSH_USER_HOSTFILE2);
#endif