telnetd: fix handling of short writes to pty
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 Oct 2016 12:54:10 +0000 (14:54 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 Oct 2016 12:54:10 +0000 (14:54 +0200)
commit2a54b3e86ebf71d5d5dce7eb95d1aa04a636e780
tree19ae37522ebebc267d3df00b10217bdbc15d483c
parent713b5133534d4bd4cfb49caba85eb3f655b6d8fd
telnetd: fix handling of short writes to pty

If a write to pty is short, remove_iacs() can be run on a buffer repeatedly.
This, for example, can eat 0xff chars (IACs, in telnet terms).

Rework the logic to handle IACs in a special "write to pty" function.

function                                             old     new   delta
telnetd_main                                        1662    1750     +88

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/telnetd.c