remove another strcpy

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14939 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-24 20:59:35 +00:00
parent 75a77c6e79
commit 5ff49eff33
4 changed files with 9 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ extern const char *new_login;
extern slcfun slctab[NSLC + 1]; /* slc mapping table */ extern slcfun slctab[NSLC + 1]; /* slc mapping table */
extern char *terminaltype; extern char terminaltype[41];
/* /*
* I/O data buffers, pointers, and counters. * I/O data buffers, pointers, and counters.

View File

@@ -54,7 +54,7 @@ int require_otp;
slcfun slctab[NSLC + 1]; /* slc mapping table */ slcfun slctab[NSLC + 1]; /* slc mapping table */
char *terminaltype; char terminaltype[41];
/* /*
* I/O data buffers, pointers, and counters. * I/O data buffers, pointers, and counters.

View File

@@ -939,7 +939,7 @@ suboption(void)
} /* end of case TELOPT_TSPEED */ } /* end of case TELOPT_TSPEED */
case TELOPT_TTYPE: { /* Yaaaay! */ case TELOPT_TTYPE: { /* Yaaaay! */
static char terminalname[41]; char *p;
if (his_state_is_wont(TELOPT_TTYPE)) /* Ignore if option disabled */ if (his_state_is_wont(TELOPT_TTYPE)) /* Ignore if option disabled */
break; break;
@@ -949,9 +949,9 @@ suboption(void)
return; /* ??? XXX but, this is the most robust */ return; /* ??? XXX but, this is the most robust */
} }
terminaltype = terminalname; p = terminaltype;
while ((terminaltype < (terminalname + sizeof terminalname-1)) && while ((p < (terminaltype + sizeof terminaltype-1)) &&
!SB_EOF()) { !SB_EOF()) {
int c; int c;
@@ -959,10 +959,9 @@ suboption(void)
if (isupper(c)) { if (isupper(c)) {
c = tolower(c); c = tolower(c);
} }
*terminaltype++ = c; /* accumulate name */ *p++ = c; /* accumulate name */
} }
*terminaltype = 0; *p = 0;
terminaltype = terminalname;
break; break;
} /* end of case TELOPT_TTYPE */ } /* end of case TELOPT_TTYPE */

View File

@@ -635,7 +635,7 @@ getterminaltype(char *name, size_t name_sz)
*/ */
_gettermname(); _gettermname();
if (strncmp(first, terminaltype, sizeof(first)) != 0) if (strncmp(first, terminaltype, sizeof(first)) != 0)
strcpy(terminaltype, first); strlcpy(terminaltype, first, sizeof(terminaltype));
break; break;
} }
} }
@@ -751,7 +751,7 @@ Please contact your net administrator");
*/ */
*user_name = 0; *user_name = 0;
level = getterminaltype(user_name, sizeof(user_name)); level = getterminaltype(user_name, sizeof(user_name));
esetenv("TERM", terminaltype ? terminaltype : "network", 1); esetenv("TERM", terminaltype[0] ? terminaltype : "network", 1);
#ifdef _SC_CRAY_SECURE_SYS #ifdef _SC_CRAY_SECURE_SYS
if (secflag) { if (secflag) {