gnucash stable: [dialog-bi-import.c] don't strcpy onto zero-length id

Christopher Lam clam at code.gnucash.org
Sun Aug 9 09:38:40 EDT 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/e0ac5f4b (commit)
	from  https://github.com/Gnucash/gnucash/commit/4b5c0d02 (commit)



commit e0ac5f4bdc4c0c943743e4e2490c350db0038c27
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Aug 9 21:29:17 2026 +0800

    [dialog-bi-import.c] don't strcpy onto zero-length id
    
    The previous line checks that id was an allocated empty string, but we
    cannot make assumptions about the allocated memory size.

diff --git a/gnucash/import-export/bi-import/dialog-bi-import.c b/gnucash/import-export/bi-import/dialog-bi-import.c
index f29743b933..192cd79384 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import.c
@@ -515,7 +515,8 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * n_rows_fixed, guint * n_row
         // If the id of the next row is blank, it takes the id of the previous row.
         if (valid && strlen(id) == 0)
         {
-            strcpy( id, running_id->str);
+            g_free (id);
+            id = g_strdup (running_id->str);
             gtk_list_store_set (store, &iter, ID, id, -1);
         }
 



Summary of changes:
 gnucash/import-export/bi-import/dialog-bi-import.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list