Fix a buffer overflow from a long local hostname.

Obtained from:	OpenBSD


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@68891 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
kris 2000-11-19 10:08:26 +00:00
parent 0ee5242ab6
commit 53049b911e

View File

@ -2900,12 +2900,12 @@ cmdrc(m1, m2)
int gotmachine = 0; int gotmachine = 0;
int l1 = strlen(m1); int l1 = strlen(m1);
int l2 = strlen(m2); int l2 = strlen(m2);
char m1save[64]; char m1save[MAXHOSTNAMELEN];
if (skiprc) if (skiprc)
return; return;
strcpy(m1save, m1); strlcpy(m1save, m1, sizeof(m1save));
m1 = m1save; m1 = m1save;
if (rcname == 0) { if (rcname == 0) {