From c2c272eaf19ac1b668f48964dedad57f1eb05365 Mon Sep 17 00:00:00 2001 From: dkulwin Date: Wed, 4 Nov 2015 18:30:33 -0600 Subject: [PATCH] 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. --- readconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readconf.c b/readconf.c index 8e3639b..c9810f7 100644 --- a/readconf.c +++ b/readconf.c @@ -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