[gtk] dnd: Be safer



commit e02fd80adbc8019f30384e0b008104c66c6739bd
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 31 16:03:33 2019 -0500

    dnd: Be safer
    
    The contents of the selection are documented
    to not be NULL if size is non-negative. So
    use an empty string instead of NULL for size 0,
    avoiding a crash.

 gtk/gtkdnd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index e9024b6442..17dbb49876 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -171,7 +171,7 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
   sdata.type = data->mime_type;
   sdata.format = 8;
   sdata.length = size;
-  sdata.data = bytes;
+  sdata.data = bytes ? bytes : (guchar *)g_strdup ("");
   sdata.display = gtk_widget_get_display (data->widget);
   
   if (site && site->target_list)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]