#1037143 netcat-openbsd: nc -t should quote IAC (i.e. '\xff')

Package:
netcat-openbsd
Source:
netcat-openbsd
Description:
TCP/IP swiss army knife
Submitter:
Uwe Kleine-König
Date:
2023-06-06 11:27:04 UTC
Severity:
normal
#1037143#5
Date:
2023-06-06 11:22:30 UTC
From:
To:
Hello,

if netcat is talking to a remote peer that implements a telnet-like
protocol (e.g. rfc2217 in my case), IAC should be quoted. That is

	printf '01234\xff\xfb\x015678' | nc -t ::1 12345

should actually send

	01234\xff\xff\xfb\x015678

because otherwise the stream is interpreted on the other side as a
command. On the receiving side the matching unquoting should happen.

(Look at the effect if the other side happens to be

	nc -t -l :: 12345

. The problem is that nc assumes it never sent a WILL request and so
should safely reply to the DONT reply with a WONT. The fix is to quote
the IAC such that the assumption "nc never sent a WILL request" becomes
true. See https://www.rfc-editor.org/rfc/rfc854, GENERAL CONSIDERATIONS
for more details.)

Best regards
Uwe