Bug 176278 - [patch] nc(1) incorrectly passes telnet option data through
Summary: [patch] nc(1) incorrectly passes telnet option data through
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2013-02-20 03:10 UTC by Paul Koch
Modified: 2017-12-31 22:29 UTC (History)
0 users

See Also:

file.diff (1.81 KB, patch)
2013-02-20 03:10 UTC, Paul Koch
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Koch 2013-02-20 03:10:00 UTC
Run /usr/bin/nc -t {ip} 23

Garbage characters appear in output.

Run /usr/bin/nc -t {ip 23 | hexdump -C

This will show something like the following at the start:

 ff fd 25 ff fb 26 ff fd ...

The ff fd xx are telnet options which should be stripped from the output.

Telnet options can occur pretty much at any time during the session, so
garbage chars will probably also appear in other places of the output.

Fix: The telnet command opt processing in netcat.c is fairly crude.
Strip the telnet options from the output buffer.

Patch attached with submission follows:
How-To-Repeat: Run nc command as above.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:53 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped