summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2022-08-26 19:30:44 +0000
committerdholland <dholland@NetBSD.org>2022-08-26 19:30:44 +0000
commitebb3c6c17c5b7a53087ce39c53199842b38e4bd7 (patch)
tree06e56e15064a8dad713ec3d8ebada629e4aaf16f /libexec
parent45a5153ad81e9a334215a4962fde57224ab12d75 (diff)
telnetd: fix the crash that's been talked about the past couple days.
(Move initialization of the slc table earlier so it doesn't get accessed before that happens.) Calling the crash a DoS or security problem is a bit overwrought; it's just a bug.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/telnetd/telnetd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index d97f6690b3e..1640fc20c4f 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: telnetd.c,v 1.57 2021/12/08 20:21:09 andvar Exp $ */
+/* $NetBSD: telnetd.c,v 1.58 2022/08/26 19:30:44 dholland Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -65,7 +65,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: telnetd.c,v 1.57 2021/12/08 20:21:09 andvar Exp $");
+__RCSID("$NetBSD: telnetd.c,v 1.58 2022/08/26 19:30:44 dholland Exp $");
#endif
#endif /* not lint */
@@ -678,6 +678,11 @@ doit(struct sockaddr *who)
char user_name[256];
/*
+ * Initialize the slc mapping table.
+ */
+ get_slc_defaults();
+
+ /*
* Find an available pty to use.
*/
pty = getpty(&ptynum);
@@ -744,11 +749,6 @@ telnet(int f, int p)
struct pollfd set[2];
/*
- * Initialize the slc mapping table.
- */
- get_slc_defaults();
-
- /*
* Do some tests where it is desirable to wait for a response.
* Rather than doing them slowly, one at a time, do them all
* at once.