Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nc/netcat telnet garbage characters

115 views
Skip to first unread message

Paul Koch

unread,
Feb 19, 2013, 2:20:40 AM2/19/13
to
Hi,

I am using FreeBSD /usr/bin/nc, which is apparently an import of the
OpenBSD nc code.

When connecting to a remote telnet daemon on port 23 and using the -t
option to process the telnet protocol commands, garbage characters
appear in the output. Passing the output through hexdump shows the
characters are telnet command options (eg. FF FD 01 FF FD ....).

This is because...

in netcat.c the following code is run:

if (tflag)
atelnet(nfd, buf, n);
if (atomicio(vwrite, lfd, buf, n) != n)
return;

The atelnet() function is processing the telnet command options but
isn't removing them from 'buf', so the write is outputting them.

atelnet() should probably remove the processed characters, compact the
'buf' and return the number of chars left in 'buf' for the write to use.

Paul Koch.

0 new messages