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
This commit is contained in:
parent
b5b07c71e8
commit
6914ffef4e
@ -658,6 +658,11 @@ doit(struct sockaddr *who)
|
|||||||
int err_; /* XXX */
|
int err_; /* XXX */
|
||||||
int ptynum;
|
int ptynum;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the slc mapping table.
|
||||||
|
*/
|
||||||
|
get_slc_defaults();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find an available pty to use.
|
* Find an available pty to use.
|
||||||
*/
|
*/
|
||||||
@ -741,11 +746,6 @@ telnet(int f, int p, char *host)
|
|||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int nfd;
|
int nfd;
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the slc mapping table.
|
|
||||||
*/
|
|
||||||
get_slc_defaults();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do some tests where it is desireable to wait for a response.
|
* Do some tests where it is desireable to wait for a response.
|
||||||
* Rather than doing them slowly, one at a time, do them all
|
* Rather than doing them slowly, one at a time, do them all
|
||||||
|
Loading…
Reference in New Issue
Block a user