Package: inetutils-telnetd Version: 2:1.9-2 Severity: normal Tags: patch Telnetd in inetutils-telnetd package lacks handling of some of TIOCPKT control bytes. The most influential thing is a lack of handling of TIOCPKT_DATA. TIOCPKT_DATAs i.e. '\0's frequently appear in the stream of network side. TIOCPKT_FLUSHREAD, TIOCPKT_STOP and TIOPKT_START leak out into network side too.
In most cases, '\0' is invisible on a terminal, therefore it is hardly noticed. However, sometimes multibyte characters are displayed incorrectly by interference of inserted '\0'. To reproduce this problem: 1) Install intetutils-telnetd package. 2) Make a typescript file by: script -qc 'telnet localhost' 3) Do something to produce some text outputs. 4) Logout from the telnet session. 5) Look into the typescript file, then you will find many extra '\0's (^@) in it. To fix this problem, I have made following patch. In this patch, the first byte from read() is always treated as a TIOCPKT control byte. Therefore, it is simply read out instead of being peeked. This is based on description in man tty_ioctl, which says the first byte returned by read() is always a TIOCPKT control byte. *** telnetd.c.orig 2012-01-01 00:02:32.000000000 +0900 --- telnetd.c 2015-02-15 14:42:29.353912672 +0900 *************** *** 601,611 **** /* Something to read from the pty... */ if (pty_read () < 0) break; ! c = pty_get_char (1); #if defined TIOCPKT_IOCTL if (c & TIOCPKT_IOCTL) { - pty_get_char (0); copy_termbuf (); localstat (); } --- 601,610 ---- /* Something to read from the pty... */ if (pty_read () < 0) break; ! c = pty_get_char (0); /* read TIOCPKT control byte */ #if defined TIOCPKT_IOCTL if (c & TIOCPKT_IOCTL) { copy_termbuf (); localstat (); } *************** *** 613,619 **** if (c & TIOCPKT_FLUSHWRITE) { static char flushdata[] = { IAC, DM }; - pty_get_char (0); netclear (); /* clear buffer back */ net_output_datalen (flushdata, sizeof (flushdata)); set_neturg (); --- 612,617 ---- *************** *** 630,636 **** IAC, SB, TELOPT_LFLOW, flowmode ? LFLOW_ON : LFLOW_OFF, IAC, SE); } - pty_get_char (0); } } --- 628,633 ---- -- System Information: Debian Release: 7.8 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 3.2.0-4-486 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages inetutils-telnetd depends on: ii libc6 2.13-38+deb7u7 ii libshishi0 1.0.1-2 ii libtinfo5 5.9-10 ii netbase 5.0 ii openbsd-inetd [inet-superserver] 0.20091229-2 ii rsyslog [system-log-daemon] 5.8.11-3+deb7u2 inetutils-telnetd recommends no packages. inetutils-telnetd suggests no packages. -- no debconf information -- Takashi Yano <takashi.y...@nifty.ne.jp> -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org