Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacktrace in the player: embedded null character #182

Closed
obilodeau opened this issue Feb 5, 2020 · 3 comments
Closed

Stacktrace in the player: embedded null character #182

obilodeau opened this issue Feb 5, 2020 · 3 comments
Labels
bug Something isn't working pyrdp-replay

Comments

@obilodeau
Copy link
Collaborator

$ pyrdp-player.py out/rdp_replay_XXX.pyrdp 
[2020-02-05 16:34:35,815] - INFO - pyrdp.player - Listening for connections on 127.0.0.1:3000
Traceback (most recent call last):
  File "/home/olivier/Documents/gosecure/src/pyrdp/pyrdp/ui/qt.py", line 150, in runOnMainThread
    target()
  File "/home/olivier/Documents/gosecure/src/pyrdp/pyrdp/player/PlayerEventHandler.py", line 60, in <lambda>
    self.viewer.mainThreadHook.emit(lambda: self.onPDUReceived(pdu, True))
  File "/home/olivier/Documents/gosecure/src/pyrdp/pyrdp/player/PlayerEventHandler.py", line 66, in onPDUReceived
    self.handlers[pdu.header](pdu)
  File "/home/olivier/Documents/gosecure/src/pyrdp/pyrdp/player/PlayerEventHandler.py", line 111, in onClipboardData
    self.writeText(f"CLIPBOARD DATA: {clipboardData}")
  File "/home/olivier/Documents/gosecure/src/pyrdp/pyrdp/player/PlayerEventHandler.py", line 52, in writeText
    self.text.insertPlainText(text)
ValueError: embedded null character
@obilodeau obilodeau added the bug Something isn't working label Feb 5, 2020
@obilodeau
Copy link
Collaborator Author

According to logs clipboard contained: https://twisted.readthedocs.io/en/twisted-18.4.0/core/howto/tap.html so there's clearly a badly handled null byte somewhere or something

@Res260
Copy link
Collaborator

Res260 commented Feb 5, 2020

Is it possible that a Qt version change caused this bug? I dont remember ever seeing it, and I'm pretty sure i copied null bytes.

@obilodeau
Copy link
Collaborator Author

> /home/olivier/Documents/gosecure/src/pyrdp/pyrdp/player/PlayerEventHandler.py(53)writeText()
     52         import ipdb; ipdb.set_trace()
---> 53         self.text.insertPlainText(text)
     54 

ipdb> text                                                                                                                                                     
'CLIPBOARD DATA: https://twisted.readthedocs.io/en/twisted-18.4.0/core/howto/tap.html\x00'
ipdb> n                                                                                                                                                        
ValueError: embedded null character

I think it's more of a Python change but I'm not sure, it could be the client's clipboard that is null-terminated. In any way, it's clear that it is a terminating null byte so we can fix this easily.

obilodeau added a commit that referenced this issue Feb 6, 2020
player: Remove trailing null bytes when printing text (fixes #182)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pyrdp-replay
Projects
None yet
Development

No branches or pull requests

2 participants