mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-05-03 20:47:57 +08:00
format security patch from Nirgal Vourgère
This commit is contained in:
parent
91cd0b7475
commit
5e4e31d1c9
@ -102,7 +102,7 @@ gmdb_help_cb(GtkWidget *button, gpointer data)
|
||||
|
||||
gnome_help_display("gmdb.xml", NULL, &error);
|
||||
if (error != NULL) {
|
||||
g_warning (error->message);
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ gmdb_prefs_help_cb(GtkWidget *w, gpointer data)
|
||||
|
||||
gnome_help_display("gmdb.xml", "gmdb-prefs", &error);
|
||||
if (error != NULL) {
|
||||
g_warning (error->message);
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ gmdb_schema_help_cb(GtkWidget *w, gpointer data)
|
||||
|
||||
gnome_help_display("gmdb.xml", "gmdb-schema", &error);
|
||||
if (error != NULL) {
|
||||
g_warning (error->message);
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
@ -104,17 +104,17 @@ gmdb_sql_write_rslt_cb(GtkWidget *w, GladeXML *xml)
|
||||
if (need_headers) {
|
||||
while (col = g_list_nth_data(glist, i)) {
|
||||
gchar *title;
|
||||
if (i>0) fprintf(outfile,delimiter);
|
||||
if (i>0) fputs(delimiter, outfile);
|
||||
title = g_strdup(gtk_tree_view_column_get_title(col));
|
||||
gmdb_print_quote(outfile, need_quote, quotechar,
|
||||
delimiter, title);
|
||||
fprintf(outfile,"%s", title);
|
||||
fputs(title, outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar,
|
||||
delimiter, title);
|
||||
g_free(title);
|
||||
i++;
|
||||
}
|
||||
fprintf(outfile,lineterm);
|
||||
fputs(lineterm, outfile);
|
||||
g_list_free(glist);
|
||||
}
|
||||
|
||||
@ -126,16 +126,16 @@ gmdb_sql_write_rslt_cb(GtkWidget *w, GladeXML *xml)
|
||||
rows++;
|
||||
n_columns = gtk_tree_model_get_n_columns(GTK_TREE_MODEL(store));
|
||||
for (i=0; i < n_columns; i++) {
|
||||
if (i>0) fprintf(outfile,delimiter);
|
||||
if (i>0) fputs(delimiter, outfile);
|
||||
gtk_tree_model_get_value(GTK_TREE_MODEL(store),
|
||||
&iter, i, &value);
|
||||
str = (gchar *) g_value_get_string(&value);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, str);
|
||||
fprintf(outfile,"%s", str);
|
||||
fputs(str, outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, str);
|
||||
g_value_unset(&value);
|
||||
}
|
||||
fprintf(outfile,lineterm);
|
||||
fputs(lineterm, outfile);
|
||||
} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
|
||||
|
||||
fclose(outfile);
|
||||
@ -433,7 +433,7 @@ gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
|
||||
if (mdb_sql_has_error(sql)) {
|
||||
GtkWidget* dlg = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (w)),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
|
||||
mdb_sql_last_error(sql));
|
||||
"%s", mdb_sql_last_error(sql));
|
||||
gtk_dialog_run (GTK_DIALOG (dlg));
|
||||
gtk_widget_destroy (dlg);
|
||||
mdb_sql_reset(sql);
|
||||
|
@ -142,7 +142,7 @@ gmdb_export_help_cb(GtkWidget *w, gpointer data)
|
||||
|
||||
gnome_help_display("gmdb.xml", "gmdb-table-export", &error);
|
||||
if (error != NULL) {
|
||||
g_warning (error->message);
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
@ -195,23 +195,23 @@ int rows=0;
|
||||
/* display column titles */
|
||||
col=g_ptr_array_index(table->columns,i);
|
||||
if (need_headers) {
|
||||
if (i>0) fprintf(outfile,delimiter);
|
||||
if (i>0) fputs(delimiter, outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, col->name);
|
||||
fprintf(outfile,"%s", col->name);
|
||||
fputs(col->name, outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, col->name);
|
||||
}
|
||||
}
|
||||
if (need_headers) fprintf(outfile,lineterm);
|
||||
if (need_headers) fputs(lineterm, outfile);
|
||||
|
||||
/* fetch those rows! */
|
||||
while(mdb_fetch_row(table)) {
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
if (i>0) fprintf(outfile,delimiter);
|
||||
if (i>0) fputs(delimiter, outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, bound_data[i]);
|
||||
fprintf(outfile,"%s", bound_data[i]);
|
||||
fputs(bound_data[i], outfile);
|
||||
gmdb_print_quote(outfile, need_quote, quotechar, delimiter, bound_data[i]);
|
||||
}
|
||||
fprintf(outfile,lineterm);
|
||||
fputs(lineterm, outfile);
|
||||
rows++;
|
||||
}
|
||||
|
||||
|
@ -205,10 +205,10 @@ main(int argc, char **argv)
|
||||
for (j=0; j<table->num_cols; j++) {
|
||||
col=g_ptr_array_index(table->columns,j);
|
||||
if (j)
|
||||
fprintf(stdout,delimiter);
|
||||
fprintf(stdout,"%s", sanitize ? sanitize_name(col->name) : col->name);
|
||||
fputs(delimiter, stdout);
|
||||
fputs(sanitize ? sanitize_name(col->name) : col->name, stdout);
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
fputs("\n", stdout);
|
||||
}
|
||||
|
||||
while(mdb_fetch_row(table)) {
|
||||
@ -222,16 +222,16 @@ main(int argc, char **argv)
|
||||
fprintf(stdout, "INSERT INTO %s%s (", namespace, quoted_name);
|
||||
free(quoted_name);
|
||||
for (j=0;j<table->num_cols;j++) {
|
||||
if (j>0) fprintf(stdout, ", ");
|
||||
if (j>0) fputs(", ", stdout);
|
||||
col=g_ptr_array_index(table->columns,j);
|
||||
if (sanitize)
|
||||
quoted_name = sanitize_name(col->name);
|
||||
else
|
||||
quoted_name = mdb->default_backend->quote_schema_name(NULL, col->name);
|
||||
fprintf(stdout,"%s", quoted_name);
|
||||
fputs(quoted_name, stdout);
|
||||
free(quoted_name);
|
||||
}
|
||||
fprintf(stdout, ") VALUES (");
|
||||
fputs(") VALUES (", stdout);
|
||||
}
|
||||
|
||||
for (j=0;j<table->num_cols;j++) {
|
||||
|
Loading…
Reference in New Issue
Block a user