Skip to content

Commit

Permalink
Merge pull request #121 from GoSecure/fix_share
Browse files Browse the repository at this point in the history
Fixed a case where DOSName had no nullbyte
  • Loading branch information
Pourliver authored Jul 2, 2019
2 parents 71d47c0 + 35d0a4f commit 6f16d65
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyrdp/parser/rdp/virtual_channel/device_redirection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 6f16d65

Please sign in to comment.