diff options
-rw-r--r-- | libexec/rpc.lockd/procs.c | 2 | ||||
-rw-r--r-- | libexec/telnetd/telnetd.c | 16 | ||||
-rw-r--r-- | usr.sbin/rpc.lockd/procs.c | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/libexec/rpc.lockd/procs.c b/libexec/rpc.lockd/procs.c index 54e5f814ceb..91a2a220cfe 100644 --- a/libexec/rpc.lockd/procs.c +++ b/libexec/rpc.lockd/procs.c @@ -64,7 +64,7 @@ static void log_from_addr(char *fun_name, struct svc_req *req) host = gethostbyaddr((char *)&(addr->sin_addr), addr->sin_len, AF_INET); if (host) { - strncpy(hostname_buf, host->h_name, sizeof(hostname_buf)); + strncpy(hostname_buf, host->h_name, sizeof(hostname_buf) -1); hostname_buf[sizeof(hostname_buf) -1] = '\0'; } else /* No hostname available - print raw address */ diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index f184628f446..a86a0aae412 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnetd.c,v 1.3 1996/04/23 03:03:55 deraadt Exp $ */ +/* $OpenBSD: telnetd.c,v 1.4 1996/08/27 10:25:28 deraadt Exp $ */ /* $NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $ */ /* @@ -45,7 +45,7 @@ static char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95"; static char rcsid[] = "$NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: telnetd.c,v 1.3 1996/04/23 03:03:55 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: telnetd.c,v 1.4 1996/08/27 10:25:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -682,12 +682,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; @@ -705,8 +707,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; } } diff --git a/usr.sbin/rpc.lockd/procs.c b/usr.sbin/rpc.lockd/procs.c index 54e5f814ceb..91a2a220cfe 100644 --- a/usr.sbin/rpc.lockd/procs.c +++ b/usr.sbin/rpc.lockd/procs.c @@ -64,7 +64,7 @@ static void log_from_addr(char *fun_name, struct svc_req *req) host = gethostbyaddr((char *)&(addr->sin_addr), addr->sin_len, AF_INET); if (host) { - strncpy(hostname_buf, host->h_name, sizeof(hostname_buf)); + strncpy(hostname_buf, host->h_name, sizeof(hostname_buf) -1); hostname_buf[sizeof(hostname_buf) -1] = '\0'; } else /* No hostname available - print raw address */ |