SLMT / telnet-rs

A simple implementation of Telnet in Rust.
MIT License
45 stars 20 forks source link

Correctly handle IAC byte escaping #4

Closed sethm closed 5 years ago

sethm commented 5 years ago

I noticed that IAC character escaping (double 0xFF) was not working quite correctly. The buffer in the event returned after the escaped IAC character was re-copying data because data_start was not being updated.

I've added a test to lib.rs to verify the fix.

sethm commented 5 years ago

Please hold off on merging this, if you're looking at it. I need to write a new test, because I appear to have broken normal IAC command handling. Oh bother.

sethm commented 5 years ago

Update: I was wrong, further tests prove that I did not break normal IAC command handling. I only thought I had, because of user error (I accidentally set the buffer size to 1 byte when creating my Telnet object, which is really not useful at all :) )

SLMT commented 5 years ago

Hello @sethm ! I just check your commits. You found a really big bug in my code. I appreciate your contribution. Thanks for your help :)

sethm commented 5 years ago

Very happy that I could help! This is a great crate, thank you for writing it.