[Bug 6488] telnet client sometimes prints garbage due to missing byte from the telnet data stream

bugzilla at busybox.net bugzilla at busybox.net
Tue Sep 17 00:01:04 UTC 2013


--- Comment #3 from Corey Ashford <cjashfor at us.ibm.com> 2013-09-17 00:01:27 UTC ---
Ok, I found several more errors in my report.  Please allow me to re-phrase it:

You can see the extra character in this example preceding the "cjashfor".

After we ran into this problem, we suspected a number of things, including the
telnet daemon, but the telnet client from the standard telnet package on Fedora
never encounters this error.

After doing some stracing, and tcpdump'ing, we discovered that in both cases,
using the standard telnet client and the busybox telnet client, tcpdump was
showing the IAC code in the telnet datastream, but in the case of busybox
telnet, the read() call sometimes doesn't return that byte, and only reads the
byte following the IAC, a 242 (decimal) byte, which is a Telnet Data Mark
command (see RFC 854).  Because there is no IAC received, this byte is
treated by the telnet client as a printable character, and is printed to
the screen.

In the case of the standard telnet client, it doesn't use read(); instead it
uses recv(), and for whatever reason it never misses this IAC byte.

As a result, I am not certain that there is a bug in the telnet client or in
the stack somewhere between the read() call and the TCP/IP socket.  Perhaps
there's an error in the busybox telnet client that it isn't properly
conditioning the socket to receive every byte. 

Note that our original problem was on an embedded system using a PowerPC
processor and 2.6.32-ish kernel, but I have replicated this problem in Fedora
18 using a 3.10 kernel on x86_64.  So the error is quite easy to reproduce.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list