Menu

#98 Bug in GTKColorCombo (crash stack)

open
nobody
None
5
2012-03-07
2012-03-07
RRaptor
No

In function gtk_color_combo_realize in file gtkcolorcombo.c function begin as
static void gtk_color_combo_realize(GtkWidget *widget)
{
GtkComboButton *combo;
GtkColorCombo *color_combo;
GdkPixmap *color_pixmap;
GtkWidget *pixmap;
GtkWidget *box;
gchar color_string[21]; // bug string
gint i,j,n;
....
But gchar color_string[21]; is very small for write data in string

sprintf(color_string,"X c %s",name);

at same function. String "X c " - 8 symbols, name represented in style "#000000000000" - 13 symbols, in all 21 symbol plus tailed /0.
But buffer is 21 byte therefore stack is crashed. For fix need replace one string in begin function for increase buffer:
static void gtk_color_combo_realize(GtkWidget *widget)
{
GtkComboButton *combo;
GtkColorCombo *color_combo;
GdkPixmap *color_pixmap;
GtkWidget *pixmap;
GtkWidget *box;
// rraptor fix
// gchar color_string[21];
gchar color_string[32];
gint i,j,n;

Discussion


Log in to post a comment.