gnucash stable: [gnc-plugin-page-report] avoid UAF from 058568eab3
Christopher Lam
clam at code.gnucash.org
Thu Nov 6 19:47:45 EST 2025
Updated via https://github.com/Gnucash/gnucash/commit/ac92388c (commit)
from https://github.com/Gnucash/gnucash/commit/7bdf31f9 (commit)
commit ac92388cad79b7943d94bf037c64b6a5a5cc9907
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Nov 7 08:38:25 2025 +0800
[gnc-plugin-page-report] avoid UAF from 058568eab3
diff --git a/gnucash/gnome/gnc-plugin-page-report.cpp b/gnucash/gnome/gnc-plugin-page-report.cpp
index ac835affdf..f45e677049 100644
--- a/gnucash/gnome/gnc-plugin-page-report.cpp
+++ b/gnucash/gnome/gnc-plugin-page-report.cpp
@@ -1604,15 +1604,8 @@ gnc_get_export_filename (SCM choice, GtkWindow *parent)
filepath = gnc_file_dialog (parent, title, nullptr, default_dir,
GNC_FILE_DIALOG_EXPORT);
- g_free (type);
- g_free (title);
- g_free (default_dir);
-
- if (!filepath)
- return nullptr;
-
/* Try to test for extension on file name, add if missing */
- if (strchr (filepath, '.') == nullptr)
+ if (filepath && strchr (filepath, '.') == nullptr)
{
char* extension = g_ascii_strdown (type, -1);
char* newpath = g_strdup_printf ("%s.%s", filepath, extension);
@@ -1621,6 +1614,13 @@ gnc_get_export_filename (SCM choice, GtkWindow *parent)
filepath = newpath;
}
+ g_free (type);
+ g_free (title);
+ g_free (default_dir);
+
+ if (!filepath)
+ return nullptr;
+
default_dir = g_path_get_dirname(filepath);
gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
g_free(default_dir);
Summary of changes:
gnucash/gnome/gnc-plugin-page-report.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
More information about the gnucash-changes
mailing list