Fixed segfaults in xclip.c:

[1657964] Copy causes segfault by Jos Dehaes
[1664930] Segmentation fault when work with VMWare on remote Windows


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1397 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2007-03-04 11:32:09 +00:00
parent a8338fcd6e
commit 3dcf92a96b

View File

@ -289,6 +289,9 @@ xclip_send_data_with_convert(uint8 * source, size_t source_size, Atom target)
DEBUG_CLIPBOARD(("xclip_send_data_with_convert: target=%s, size=%u\n",
XGetAtomName(g_display, target), (unsigned) source_size));
if ((!source) || source_size == 0)
return False;
#ifdef USE_UNICODE_CLIPBOARD
if (target == format_string_atom ||
target == format_unicode_atom || target == format_utf8_string_atom)
@ -754,7 +757,7 @@ void
xclip_handle_SelectionRequest(XSelectionRequestEvent * event)
{
unsigned long nitems, bytes_left;
unsigned char *prop_return;
unsigned char *prop_return = NULL;
int format, res;
Atom type;
@ -796,7 +799,7 @@ xclip_handle_SelectionRequest(XSelectionRequestEvent * event)
event->property, 0, 1, True,
XA_INTEGER, &type, &format, &nitems, &bytes_left,
&prop_return);
if (res != Success)
if (res != Success || (!prop_return))
{
DEBUG_CLIPBOARD(("Requested native format but didn't specifiy which.\n"));
xclip_refuse_selection(event);