aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2022-09-26 17:56:51 +0000
committerBrooks Davis <brooks@FreeBSD.org>2022-09-29 22:30:48 +0000
commit6abdfd389044a9fe193d0b88ae5510c4a68b01b4 (patch)
treefd0cd20005517b52b482aa85af4315329ad258f7
parentd31a21b939f7b1380f3055374317b71a034976a4 (diff)
downloadsrc-6abdfd389044a9fe193d0b88ae5510c4a68b01b4.tar.gz
src-6abdfd389044a9fe193d0b88ae5510c4a68b01b4.zip
telnetd: fix two-byte input crash
Move initialization of the slc table earlier so it doesn't get accessed before that happens. For details on the issue, see: https://pierrekim.github.io/blog/2022-08-24-2-byte-dos-freebsd-netbsd-telnetd-netkit-telnetd-inetutils-telnetd-kerberos-telnetd.html Reviewed by: cy Obtained from: NetBSD via cy Differential Revision: https://reviews.freebsd.org/D36680 (cherry picked from commit 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8)
-rw-r--r--contrib/telnet/telnetd/telnetd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c
index 522877829735..e12fe70997ab 100644
--- a/contrib/telnet/telnetd/telnetd.c
+++ b/contrib/telnet/telnetd/telnetd.c
@@ -659,6 +659,11 @@ doit(struct sockaddr *who)
int ptynum;
/*
+ * Initialize the slc mapping table.
+ */
+ get_slc_defaults();
+
+ /*
* Find an available pty to use.
*/
#ifndef convex
@@ -742,11 +747,6 @@ telnet(int f, int p, char *host)
int nfd;
/*
- * Initialize the slc mapping table.
- */
- get_slc_defaults();
-
- /*
* Do some tests where it is desireable to wait for a response.
* Rather than doing them slowly, one at a time, do them all
* at once.