git: 6914ffef4e23 - main - telnetd: fix two-byte input crash
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Sep 2022 17:57:32 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=6914ffef4e2318ca1d0ead28eafb6f06055ce0f8 commit 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2022-09-26 17:56:51 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2022-09-26 17:57:18 +0000 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 --- contrib/telnet/telnetd/telnetd.c | 10 +++++----- 1 file 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 @@ -658,6 +658,11 @@ doit(struct sockaddr *who) int err_; /* XXX */ int ptynum; + /* + * Initialize the slc mapping table. + */ + get_slc_defaults(); + /* * Find an available pty to use. */ @@ -741,11 +746,6 @@ telnet(int f, int p, char *host) struct stat statbuf; 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