x11: Don't assume valid type

If we get an invalid TARGETS reply, we might not have a valid 'type',
which ends up as NULL and segs in the g_str_equal.

(This is probably fallout from my fix 506566b6a4, which I still
can't reproduce reliably, so the last one just moved the seg a bit
further along, and we still don't know who is sending a bad TARGETS).

This corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=2062143
This commit is contained in:
Dr. David Alan Gilbert 2022-07-30 16:39:18 +01:00
parent 924da0e84b
commit dbc4e18bf8

View File

@ -358,10 +358,10 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source,
g_error_free (error);
return;
}
else if (!g_str_equal (type, "ATOM") || format != 32)
else if (g_strcmp0 (type, "ATOM") != 0 || format != 32)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32\n",
cb->selection, type, format));
cb->selection, type ? type : "NULL", format));
g_input_stream_close (stream, NULL, NULL);
g_object_unref (stream);
g_object_unref (cb);