History log of /freebsd-current/contrib/telnet/telnet/telnet.c
Revision Date Author Comments
# c794d188 21-Dec-2023 Dimitry Andric <dim@FreeBSD.org>

Fix snprintf truncation in telnet

Building telnet with clang 18 results in the following warning:

contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation]
231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT,
| ^

The temp2 buffer is 10 chars, while the format string also consists of
10 chars. Therefore, snprintf(3) will truncate the last character, 'SE'
(end sub negotation) in this case.

Bump the buffer to 11 chars to avoid truncation.

MFC after: 3 days


# a3c85800 27-Nov-2023 Brooks Davis <brooks@FreeBSD.org>

telnet: remove locally added __FBSDID

This partially reverts 77b7cdf1999ee965ad494fddd184b18f532ac91a.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42704


# 83129c0b 15-Aug-2019 Ed Maste <emaste@FreeBSD.org>

telnet: remove 3rd clause from Berkeley copyrights

Per the July 22, 1999 letter (in /COPYRIGHT) from
William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

MFC after: 1 week


# e68ce1cc 10-Jul-2019 Philip Paeps <philip@FreeBSD.org>

telnet: fix a couple of snprintf() buffer overflows

Obtained from: Juniper Networks
MFC after: 1 week


# ad11def5 10-Nov-2014 Enji Cooper <ngie@FreeBSD.org>

Add baud rate support to telnet(1)

This implements part of RFC-2217

It's based off a patch originally written by Sujal Patel at Isilon, and
contributions from other Isilon employees.

PR: 173728
Phabric: D995
Reviewed by: markj, markm
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# f1ce4e8a 07-May-2010 Jilles Tjoelker <jilles@FreeBSD.org>

MFC r207449: telnet: Fix infinite loop if local output generates SIGPIPE.

Instead of catching SIGPIPE and jumping out of the signal handler with
longjmp, ignore it and handle write errors to the local output by exiting
from there. I have changed the error message to mention the local output
instead of NetBSD's wrong "Connection closed by foreign host". Write errors
to the network were already handled by exiting immediately and this now
applies to EPIPE too.

The code assumed that SIGPIPE could only be generated by the network
connection; if it was generated by the local output, it would longjmp out of
the signal handler and write an error message which caused another SIGPIPE.

PR: 19773
Obtained from: NetBSD


# 524461f1 30-Apr-2010 Jilles Tjoelker <jilles@FreeBSD.org>

telnet: Fix infinite loop if local output generates SIGPIPE.

Instead of catching SIGPIPE and jumping out of the signal handler with
longjmp, ignore it and handle write errors to the local output by exiting
from there. I have changed the error message to mention the local output
instead of NetBSD's wrong "Connection closed by foreign host". Write errors
to the network were already handled by exiting immediately and this now
applies to EPIPE too.

The code assumed that SIGPIPE could only be generated by the network
connection; if it was generated by the local output, it would longjmp out of
the signal handler and write an error message which caused another SIGPIPE.

PR: 19773
Obtained from: NetBSD
MFC after: 1 week


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 14aab889 28-Mar-2005 Jacques Vidrine <nectar@FreeBSD.org>

Correct a pair of buffer overflows in the telnet(1) command:

(CAN-2005-0468) A heap buffer overflow in env_opt_add() and related
functions.

(CAN-2005-0469) A global uninitialized data section buffer overflow in
slc_add_reply() and related functions.

As a result of these vulnerabilities, it may be possible for a malicious
telnet server or active network attacker to cause telnet(1) to execute
arbitrary code with the privileges of the user running it.

Security: CAN-2005-0468, CAN-2005-0469
Security: FreeBSD-SA-05:01.telnet
Security: http://www.idefense.com/application/poi/display?id=220&type=vulnerabilities
Security: http://www.idefense.com/application/poi/display?id=221&type=vulnerabilities

These fixes are based in part on patches
Submitted by: Solar Designer <solar@openwall.com>


# 3a44a4c3 27-Feb-2005 Anton Berezin <tobez@FreeBSD.org>

Increase usefulness of telnet(1) as a protocol tester. By prepending
"+" to the port number, disable option negotiation and allow
transferring of data with high bit set.

OKed by: markm (maintainer)
PR: 52032
Submitted by: Valentin Nechayev <netch maybe-at netch stop kiev stop ua>
MFC After: 2 weeks


# 074e8e8e 11-May-2003 Mark Murray <markm@FreeBSD.org>

Fix up external variables named "debug" that have a horrible habit
of conflicting with other, similarly named functions in static
libraries. This is done mostly by renaming the var if it is shared
amongst modules, or making it static otherwise.

OK'ed by: re(scottl)


# 77b7cdf1 03-May-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID vs. rcsid[]. Also protect sccs[] and copyright[] from GCC 3.3.


# 86953b02 25-Sep-2002 Mark Murray <markm@FreeBSD.org>

Catch up with "base" telnet.

s/FALL THROUGH/FALLTHROUGH/ for lint(1).
s/Usage/usage/ for consistency.


# 8fa113e5 30-Nov-2001 Mark Murray <markm@FreeBSD.org>

Very large style makeover.

1) ANSIfy.
2) Clean up ifdefs so that
a) ones that never/always apply are appropriately either
fully removed, or just the #if junk is removed.
b) change #if defined(FOO) for appropiate values of FOO.
(currently AUTHENTICATION and ENCRYPTION)
3) WARNS=2 fixing
4) GC other unused stuff

This code can now be unifdef(1)ed to make non-crypto telnet.


# 21f083c0 19-Aug-2001 Mark Murray <markm@FreeBSD.org>

Code merge and diff reduce with "base" telnet. This is the "later"
telnet, so it was treated as the reference code, except where later
commits were made to "base" telnet.


# cd189e11 15-May-2001 Peter Wemm <peter@FreeBSD.org>

Hack to work around braindeath in libtelnet:sra.c. The sra.o file
references global variables from telnetd, but is also linked into
telnet as well. I was tempted to back out the last sra.c change
as it is 100% bogus and should be taken out and shot, but for now
this bandaid should get world working again. :-(


# 9a01d32b 06-Feb-2001 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>

Fix typo: seperate -> separate.

Seperate does not exist in the english language.

Submitted to look at by: kris


# 579c78c7 28-Oct-2000 Kris Kennaway <kris@FreeBSD.org>

Sync with usr.bin/telnet/telnet.c r1.9 - fix buffer overflow in DISPLAY


# ecece7e3 15-Jul-2000 Peter Wemm <peter@FreeBSD.org>

Add missing $FreeBSD$ to files that are NOT still on vendor a branch.


# 2d8a17c7 01-Sep-1999 Mark Murray <markm@FreeBSD.org>

Termcap header no longer needed.


# 42cf8219 17-Jun-1999 Ruslan Ermilov <ru@FreeBSD.org>

Merge from non-crypto version:
- "-N" option
- "-E" security fix
- "-s src_addr" option

Requested by: markm


# 04c426cc 07-Sep-1997 Mark Murray <markm@FreeBSD.org>

Bring the FreeBSD changes to the virgin sources.


# 81cb6ddc 04-Sep-1997 Mark Murray <markm@FreeBSD.org>

Initial import of BSD telnet. This will be used to build the kerberised
telnet, and after userland diffs have been merged in, will be used to
build the non-kerberised sources as well. (See unifdef(1) for details)