dnd: Be safer
authorMatthias Clasen <mclasen@redhat.com>
Tue, 31 Dec 2019 21:03:33 +0000 (16:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 1 Jan 2020 17:51:19 +0000 (12:51 -0500)
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

index e9024b6442e67a4cd803db86300614b3604d572f..17dbb49876f0554591633d63f5c157e353163889 100644 (file)
@@ -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)