From 227afb3793ceb9d17179d6e898a46ce044559f62 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Thu, 13 Jun 2013 23:38:20 -0700 Subject: [PATCH] Ticket #261: Handled NULL bitmaps in guac_rdp_bitmap_setsurface and guac_rdp_gdi_memblt functions. --- src/protocols/rdp/rdp_bitmap.c | 6 ++++++ src/protocols/rdp/rdp_gdi.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index ca11e2e9..b5123100 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -183,6 +183,12 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean else { + /* Make sure that the recieved bitmap is not NULL before processing */ + if (bitmap == NULL) { + guac_client_log_info(client, "NULL bitmap found in bitmap_setsurface instruction."); + return; + } + /* If not available as a surface, make available. */ if (((guac_rdp_bitmap*) bitmap)->layer == NULL) guac_rdp_cache_bitmap(context, bitmap); diff --git a/src/protocols/rdp/rdp_gdi.c b/src/protocols/rdp/rdp_gdi.c index 8fc587e1..55114cce 100644 --- a/src/protocols/rdp/rdp_gdi.c +++ b/src/protocols/rdp/rdp_gdi.c @@ -361,6 +361,13 @@ void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) { int y_src = memblt->nYSrc; rdp_guac_client_data* data = (rdp_guac_client_data*) client->data; + + /* Make sure that the recieved bitmap is not NULL before processing */ + if (bitmap == NULL) { + guac_client_log_info(client, "NULL bitmap found in memblt instruction."); + return; + } + pthread_mutex_lock(&(data->update_lock)); /* Clip operation to bounds */