diff options
| author | Paul Traina <pst@FreeBSD.org> | 1997-01-07 19:00:52 +0000 |
|---|---|---|
| committer | Paul Traina <pst@FreeBSD.org> | 1997-01-07 19:00:52 +0000 |
| commit | a29e4eaa60248a87a6bd62751f738f9d2fd2051c (patch) | |
| tree | 8a07ae32e6d529f41b05f497daa2b3bf4fc0150d /libexec/telnetd/telnetd.c | |
| parent | 1c594de59d77813bb922c8523569ef619c5c5ca2 (diff) | |
Notes
Diffstat (limited to 'libexec/telnetd/telnetd.c')
| -rw-r--r-- | libexec/telnetd/telnetd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index afbced32c40a..1c57eb0ba84e 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: telnetd.c,v 1.7 1996/09/22 21:55:46 wosch Exp $ */ #ifndef lint @@ -668,12 +668,14 @@ getterminaltype(name) * we have to just go with what we (might) have already gotten. */ if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) { - (void) strncpy(first, terminaltype, sizeof(first)); + (void) strncpy(first, terminaltype, sizeof(first)-1); + first[sizeof(first)-1] = '\0'; for(;;) { /* * Save the unknown name, and request the next name. */ - (void) strncpy(last, terminaltype, sizeof(last)); + (void) strncpy(last, terminaltype, sizeof(last)-1); + last[sizeof(last)-1] = '\0'; _gettermname(); if (terminaltypeok(terminaltype)) break; @@ -691,8 +693,10 @@ getterminaltype(name) * the start of the list. */ _gettermname(); - if (strncmp(first, terminaltype, sizeof(first)) != 0) - (void) strncpy(terminaltype, first, sizeof(first)); + if (strncmp(first, terminaltype, sizeof(first)) != 0) { + (void) strncpy(terminaltype, first, sizeof(terminaltype)-1); + terminaltype[sizeof(terminaltype)-1] = '\0'; + } break; } } |
