diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-01-29 16:33:30 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-01-29 16:33:30 +0000 |
commit | 0cad69fcdda49e5c950e220696aa5b45a0b702c5 (patch) | |
tree | bf6018f77751bb394bb2a2cf9fcafb3441abf8ef /gtk/gtkselection.c | |
parent | 598eebb8bfb99ee0562da0c0a1fda7a7eabc5b3b (diff) | |
download | gdk-pixbuf-0cad69fcdda49e5c950e220696aa5b45a0b702c5.tar.gz |
nul-terminate the target atoms. (#132656, Christian Persch)
Thu Jan 29 11:00:18 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_default_handler):
nul-terminate the target atoms. (#132656, Christian Persch)
Diffstat (limited to 'gtk/gtkselection.c')
-rw-r--r-- | gtk/gtkselection.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index 6d976896e..e14135e25 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -1884,9 +1884,12 @@ gtk_selection_default_handler (GtkWidget *widget, data->type = GDK_SELECTION_TYPE_ATOM; data->format = 32; data->length = count * sizeof (GdkAtom); - - p = g_new (GdkAtom, count); + + /* selection data is always terminated by a trailing \0 + */ + p = g_malloc (data->length + 1); data->data = (guchar *)p; + data->data[data->length] = '\0'; *p++ = gtk_selection_atoms[TIMESTAMP]; *p++ = gtk_selection_atoms[TARGETS]; |