Merge pull request #482 from absmall/master

xfreerdp crashes when connecting to xfreerdp-server
This commit is contained in:
Marc-André Moreau 2012-03-04 15:16:24 -08:00
commit fbfd2bf74d
2 changed files with 35 additions and 23 deletions

View File

@ -966,6 +966,9 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
/* Validate that the data received is large enough */
if( surface_bits_command->width * surface_bits_command->height * surface_bits_command->bpp / 8 <= surface_bits_command->bitmapDataLength )
{
xfi->bmp_codec_none = (uint8*) xrealloc(xfi->bmp_codec_none,
surface_bits_command->width * surface_bits_command->height * 4);
@ -991,6 +994,9 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
surface_bits_command->width, surface_bits_command->height);
XSetClipMask(xfi->display, xfi->gc, None);
} else {
printf("Invalid bitmap size - data is %d bytes for %dx%d\n update", surface_bits_command->bitmapDataLength, surface_bits_command->width, surface_bits_command->height);
}
}
else
{

View File

@ -555,6 +555,12 @@ boolean xf_peer_post_connect(freerdp_peer* client)
printf("Client requested desktop: %dx%dx%d\n",
client->settings->width, client->settings->height, client->settings->color_depth);
if (!client->settings->rfx_codec)
{
printf("Client does not support RemoteFX\n");
return 0;
}
/* A real server should tag the peer as activated here and start sending updates in mainloop. */
client->settings->width = xfi->width;