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

Telnet rawq_getchar returns empty string #241

Open
claytonsingh opened this issue Jan 15, 2025 · 0 comments
Open

Telnet rawq_getchar returns empty string #241

claytonsingh opened this issue Jan 15, 2025 · 0 comments

Comments

@claytonsingh
Copy link

claytonsingh commented Jan 15, 2025

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:

c = self.rawq[self.irawq]
if not py2:
c = c.to_bytes((c.bit_length()+7)//8, 'big')

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').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant