From ebb6222752bab1229d063f3c36e2edc3dad50761 Mon Sep 17 00:00:00 2001 From: luciaprime54 <156635296+luciaprime54@users.noreply.github.com> Date: Mon, 15 Jan 2024 05:43:59 +0000 Subject: [PATCH] Set a default value for clipboard clipDataId, to handle non-windows clients like xfreeRDP --- pyrdp/parser/rdp/virtual_channel/clipboard.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyrdp/parser/rdp/virtual_channel/clipboard.py b/pyrdp/parser/rdp/virtual_channel/clipboard.py index 18db8e1a3..bdb4139d3 100644 --- a/pyrdp/parser/rdp/virtual_channel/clipboard.py +++ b/pyrdp/parser/rdp/virtual_channel/clipboard.py @@ -51,7 +51,12 @@ def parseFileContentsRequest(self, payload, msgFlags): posLo = Uint32LE.unpack(stream) posHi = Uint32LE.unpack(stream) cbRequested = Uint32LE.unpack(stream) - clipDataId = Uint32LE.unpack(stream) + # xfreeRDP (and maybe other non-Windows clients?) don't send a clipDataId. + # Currently we don't use clipDataId for anything, so we can safely just set it to 0. + try: + clipDataId = Uint32LE.unpack(stream) + except ValueError: + clipDataId = 0 pos = posHi << 32 | posLo return FileContentsRequestPDU(payload, streamId, lindex, msgFlags, dwFlags, pos, cbRequested, clipDataId)