From 56e67d882e460457e8096f3d2311392f8d82920b Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Tue, 5 Jan 2010 22:37:30 +0000 Subject: [PATCH] Bug #589032: Replace some strcmp() by safe_strcmp() to fix crashes on NULL strings. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18551 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/import-export/csv/gnc-csv-import.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/import-export/csv/gnc-csv-import.c b/src/import-export/csv/gnc-csv-import.c index e9357f94d8..3e93d37ce5 100644 --- a/src/import-export/csv/gnc-csv-import.c +++ b/src/import-export/csv/gnc-csv-import.c @@ -253,7 +253,7 @@ static void ok_button_clicked(GtkWidget* widget, GncCsvPreview* preview) for(i = 0; i < ncols; i++) { int type; /* The column type contained in this column. */ - gchar* contents; /* The column type string in this column. */ + gchar* contents = NULL; /* The column type string in this column. */ /* Get the type string first. (store is arranged so that every two * columns is a pair of the model used for the combobox and the * string that appears, so that store looks like: @@ -264,7 +264,7 @@ static void ok_button_clicked(GtkWidget* widget, GncCsvPreview* preview) for(type = 0; type < GNC_CSV_NUM_COL_TYPES; type++) { /* ... we find one that matches with what's in the column. */ - if(!strcmp(contents, _(gnc_csv_column_type_strs[type]))) + if(!safe_strcmp(contents, _(gnc_csv_column_type_strs[type]))) { /* Set the column_types array appropriately and quit. */ column_types->data[i] = type; @@ -358,14 +358,14 @@ static void column_type_edited(GtkCellRenderer* renderer, gchar* path, if(col_renderer != renderer) { /* The string that appears in the column */ - gchar* contents; + gchar* contents = NULL; /* Get the type string. (store is arranged so that every two * columns is a pair of the model used for the combobox and the * string that appears, so that store looks like: * model 0, string 0, model 1, string 1, ..., model ncols, string ncols. */ gtk_tree_model_get(store, &iter, 2*i+1, &contents, -1); /* If this column has the same string that the user selected ... */ - if(!strcmp(contents, new_text)) + if(!safe_strcmp(contents, new_text)) { /* ... set this column to the "None" type. (We can't allow duplicate types.) */ gtk_list_store_set(GTK_LIST_STORE(store), &iter, 2*i+1,