r18551 - gnucash/trunk/src/import-export/csv - Bug #589032: Replace some strcmp() by safe_strcmp() to fix crashes on NULL strings.
Christian Stimming
cstim at code.gnucash.org
Tue Jan 5 17:37:31 EST 2010
Author: cstim
Date: 2010-01-05 17:37:30 -0500 (Tue, 05 Jan 2010)
New Revision: 18551
Trac: http://svn.gnucash.org/trac/changeset/18551
Modified:
gnucash/trunk/src/import-export/csv/gnc-csv-import.c
Log:
Bug #589032: Replace some strcmp() by safe_strcmp() to fix crashes on NULL strings.
Modified: gnucash/trunk/src/import-export/csv/gnc-csv-import.c
===================================================================
--- gnucash/trunk/src/import-export/csv/gnc-csv-import.c 2010-01-05 22:09:45 UTC (rev 18550)
+++ gnucash/trunk/src/import-export/csv/gnc-csv-import.c 2010-01-05 22:37:30 UTC (rev 18551)
@@ -253,7 +253,7 @@
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 @@
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 @@
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,
More information about the gnucash-changes
mailing list