[Commits] [SCM] claws branch, gtk2, updated. 3.20.0-45-g4d908b72d
mones at claws-mail.org
mones at claws-mail.org
Sat Feb 10 19:06:07 UTC 2024
The branch, gtk2 has been updated
via 4d908b72ddb3f649a60bfaa04e2bf5377aa7debc (commit)
from a2ab42fbd429c2026a160ffa22f2196e1c448ec2 (commit)
Summary of changes:
src/common/plugin.c | 5 +++--
src/common/prefs.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 4d908b72ddb3f649a60bfaa04e2bf5377aa7debc
Author: Ricardo Mones <ricardo at mones.org>
Date: Sat Feb 10 20:04:16 2024 +0100
Fix CID 1491211 'Use after free'
The function prefs_set_block_label frees its pfile argument on error
(via prefs_file_close_revert calls) and also returns -1, so use the
returned value to check instead of the freed pointer.
Update function documentation while we're at it.
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 839958b8d..5c853b2b2 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -595,16 +595,17 @@ void plugin_load_all(const gchar *type)
gchar buf[BUFFSIZE];
PrefFile *pfile;
gchar *error = NULL, *block;
+ gint failed = 0;
plugin_types = g_slist_append(plugin_types, g_strdup(type));
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
block = g_strconcat(PLUGINS_BLOCK_PREFIX, type, NULL);
if ((pfile = prefs_read_open(rcpath)) == NULL ||
- (prefs_set_block_label(pfile, block) < 0)) {
+ ((failed = prefs_set_block_label(pfile, block)) < 0)) {
g_free(rcpath);
g_free(block);
- if (pfile)
+ if (!failed)
prefs_file_close(pfile);
return;
}
diff --git a/src/common/prefs.c b/src/common/prefs.c
index 12df810a2..acba64087 100644
--- a/src/common/prefs.c
+++ b/src/common/prefs.c
@@ -265,7 +265,7 @@ gboolean prefs_rc_is_readonly(const gchar * rcfile)
*
*\param pfile Preferences file struct
*
- *\return 0 on success, -1 on failure
+ *\return 0 on success, -1 on failure and pfile is freed.
*/
gint prefs_set_block_label(PrefFile *pfile, const gchar *label)
{
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list