c - Getting a “format not a string literal and no format arguments” warning while using GTK+2 -
i getting error this:
warning: format not string literal , no format arguments [-wformat-security] gtk_buttons_ok, (const gchar*)message); ^
because of function:
static void show_message (gchar *message, gtkmessagetype type) { gtkwidget *dialog = gtk_message_dialog_new(null, 0, type, gtk_buttons_ok, message); gtk_dialog_run(gtk_dialog(dialog)); gtk_widget_destroy(dialog); }
how can fix it?
the answer quite simple.
you have add "%s"
arguments of gtk_message_dialog_new()
function this:
static void show_message (gchar *message, gtkmessagetype type) { gtkwidget *dialog = gtk_message_dialog_new(null, 0, type, gtk_buttons_ok, "%s", message); gtk_dialog_run(gtk_dialog(dialog)); gtk_widget_destroy(dialog); }
basically, lack of "%s"
considered non-secure gcc
.
you can read more here:
Comments
Post a Comment