From 8cdec40083e218bc96e8d50881785c953e1c7d12 Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:55:48 +0000 Subject: [PATCH] Don't enable GFX if client doesn't support 32 BPP mstsc.exe indicates it supports GFX in the early capability flags, even if it not able to support 32 BPP. This results in a session failure if a RDPGFX_CAPS_CONFIRM_PDU is sent on the EGFX virtual channel. --- libxrdp/xrdp_sec.c | 14 ++++++++++++-- xrdp/xrdp_mm.c | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 6c2057aeb1..bc3551fd5d 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -2138,15 +2138,25 @@ xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec *self, struct stream *s) { client_info->bpp = 32; } +#ifdef XRDP_RFXCODEC if (earlyCapabilityFlags & RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL) { - LOG(LOG_LEVEL_INFO, "client supports gfx protocol"); - self->rdp_layer->client_info.gfx = 1; + if (client_info->bpp < 32) + { + LOG(LOG_LEVEL_WARNING, + "client requested gfx protocol with insufficient color depth"); + } + else + { + LOG(LOG_LEVEL_INFO, "client supports gfx protocol"); + self->rdp_layer->client_info.gfx = 1; + } } else { LOG_DEVEL(LOG_LEVEL_INFO, "client DOES NOT support gfx"); } +#endif if (!s_check_rem(s, 64)) { return 0; diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 62082022cc..6d6279f1ef 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -1484,8 +1484,7 @@ int egfx_initialize(struct xrdp_mm *self) { LOG_DEVEL(LOG_LEVEL_TRACE, "egfx_initialize"); - if (!(self->wm->client_info->mcs_early_capability_flags - & RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL)) + if (!(self->wm->client_info->gfx)) { return 0; }