diff --git a/pyrdp/parser/rdp/virtual_channel/device_redirection.py b/pyrdp/parser/rdp/virtual_channel/device_redirection.py index 9914ae214..26b672cd5 100644 --- a/pyrdp/parser/rdp/virtual_channel/device_redirection.py +++ b/pyrdp/parser/rdp/virtual_channel/device_redirection.py @@ -143,7 +143,11 @@ def parseDeviceAnnounce(self, stream: BytesIO) -> DeviceAnnounce: deviceData = stream.read(deviceDataLength) preferredDOSName = preferredDOSName.decode(errors = "ignore")[: 7] - endIndex = preferredDOSName.index("\x00") + + try: + endIndex = preferredDOSName.index("\x00") + except ValueError: + endIndex = -1 if endIndex >= 0: preferredDOSName = preferredDOSName[: endIndex]