Ticket #4620: (sftpfs_fill_connection_data_from_config): fix use-after-free.

Fix Use-after-free in sftpfs_fill_connection_data_from_config()

Found by Clang-19 Static Analyzer

The bug was introduced in 4c998ac636.

Reported-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-12-18 21:00:00 +00:00
parent 0df9c46cd1
commit d0d8ae90eb

View File

@ -393,9 +393,12 @@ sftpfs_fill_connection_data_from_config (struct vfs_s_super *super, GError **mce
if (config_entity->real_host != NULL)
{
g_free (super->path_element->host);
char *tmp_str = super->path_element->host;
super->path_element->host =
sftpsfs_expand_hostname (super->path_element->host, config_entity->real_host);
g_free (tmp_str);
}
if (config_entity->identity_file != NULL)