net-telnet
net-telnet copied to clipboard
Process command sequences before other processing
Changes the order of operations in preprocess so the valid sequence IAC DO OPT_BINARY is correctly interpreted as a command sequence with Binmode=false. As suboption negotiation may contain any byte sequence all other processing is done after the command sequences are handled.
Prior to this change the sequence IAC DO OPT_BINARY would be truncated to IAC DO when Binmode=false. Depending on what followed either an arbitrary byte could be interpreted as the option or the sequence IAC DO could be passed through to the client. In my case the overall sequence was IAC WILL OPT_BINARY IAC DO OPT_NAWS which after NULL deletion was parsed as IAC WILL OPT_EXOPL with a trailing DO OPT_NAWS.