exscript icon indicating copy to clipboard operation
exscript copied to clipboard

Telnet rawq_getchar returns empty string

Open claytonsingh opened this issue 1 year ago • 0 comments

In the telnetlib.py file, the rawq_getchar function returns an empty string (b'') when self.rawq[self.irawq] evaluates to 0. This seems to be caused by the line of code:

https://github.com/knipknap/exscript/blob/9d5b035f3de4237dc6ecb7437b3ebd0c162bb6ec/Exscript/protocols/telnetlib.py#L574-L576

This issue appears to be related to the conversion of an integer value of 0 to bytes, which results in an empty byte string instead of a null byte character.

Steps to Reproduce:

Call rawq_getchar when self.rawq[self.irawq] is 0. Observe that instead of returning the expected byte value, an empty string b'' is returned.

Expected Behavior:

When self.rawq[self.irawq] is 0, the method should ideally return a representation of the null byte (b'\x00').

claytonsingh avatar Jan 15 '25 20:01 claytonsingh