From cda5c62926a8a8dccfcacb47e7ea4ab610987a0f Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Wed, 18 Dec 2024 21:00:00 +0000
Subject: [PATCH] (config_parser.c) fix use-after-free
Fix Use-after-free in sftpfs_fill_connection_data_from_config()
Found by Clang-19 Static Analyzer
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/vfs/sftpfs/config_parser.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/vfs/sftpfs/config_parser.c b/src/vfs/sftpfs/config_parser.c
index 622ac3266..5e5741cfc 100644
a
|
b
|
sftpfs_fill_connection_data_from_config (struct vfs_s_super *super, GError **mce |
374 | 374 | { |
375 | 375 | sftpfs_super_t *sftpfs_super = SFTP_SUPER (super); |
376 | 376 | sftpfs_ssh_config_entity_t *config_entity; |
| 377 | char *tmp_str = NULL; |
377 | 378 | |
378 | 379 | mc_return_if_error (mcerror); |
379 | 380 | |
… |
… |
sftpfs_fill_connection_data_from_config (struct vfs_s_super *super, GError **mce |
393 | 394 | |
394 | 395 | if (config_entity->real_host != NULL) |
395 | 396 | { |
| 397 | tmp_str = g_strdup (super->path_element->host); |
396 | 398 | g_free (super->path_element->host); |
| 399 | |
397 | 400 | super->path_element->host = |
398 | | sftpsfs_expand_hostname (super->path_element->host, config_entity->real_host); |
| 401 | sftpsfs_expand_hostname (tmp_str, config_entity->real_host); |
| 402 | |
| 403 | g_free (tmp_str); |
399 | 404 | } |
400 | 405 | |
401 | 406 | if (config_entity->identity_file != NULL) |