Fix possible buffer overruns. From OpenBSD, but without breaking stuff.

This commit is contained in:
mjl 2001-01-03 12:41:00 +00:00
parent c5fd828440
commit 6c2663f7dd
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: commands.c,v 1.43 2000/06/22 06:47:48 thorpej Exp $ */ /* $NetBSD: commands.c,v 1.44 2001/01/03 12:41:00 mjl Exp $ */
/* /*
* Copyright (C) 1997 and 1998 WIDE Project. * Copyright (C) 1997 and 1998 WIDE Project.
@ -67,7 +67,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#else #else
__RCSID("$NetBSD: commands.c,v 1.43 2000/06/22 06:47:48 thorpej Exp $"); __RCSID("$NetBSD: commands.c,v 1.44 2001/01/03 12:41:00 mjl Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -2830,12 +2830,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 + 1];
if (skiprc) if (skiprc)
return; return;
strcpy(m1save, m1); strlcpy(m1save, m1, sizeof(m1save));
m1 = m1save; m1 = m1save;
if (rcname == 0) { if (rcname == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.13 2000/06/22 06:47:48 thorpej Exp $ */ /* $NetBSD: main.c,v 1.14 2001/01/03 12:41:00 mjl Exp $ */
/* /*
* Copyright (c) 1988, 1990, 1993 * Copyright (c) 1988, 1990, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95"; static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
#else #else
__RCSID("$NetBSD: main.c,v 1.13 2000/06/22 06:47:48 thorpej Exp $"); __RCSID("$NetBSD: main.c,v 1.14 2001/01/03 12:41:00 mjl Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -293,8 +293,8 @@ main(argc, argv)
break; break;
case 't': case 't':
#if defined(TN3270) && defined(unix) #if defined(TN3270) && defined(unix)
(void)strlcpy(tline, optarg, sizeof(tline));
transcom = tline; transcom = tline;
(void)strcpy(transcom, optarg);
#else #else
fprintf(stderr, fprintf(stderr,
"%s: Warning: -t ignored, no TN3270 support.\n", "%s: Warning: -t ignored, no TN3270 support.\n",