diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-06-11 15:18:54 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-06-11 15:18:54 +0000 |
commit | 17fdbbbbd36dd0f57381719477a4df3a9771df26 (patch) | |
tree | f5156d1d8e47c08bc274d75009b0aa67541e2fa1 /libexec/rshd/rshd.c | |
parent | bbbf292a68225de030d9d9ced38e0bce00decab0 (diff) |
strncpy vs strlcpy, some strlen missuse.
some other related minor cleanups, and spaces.
millert@ ok
Diffstat (limited to 'libexec/rshd/rshd.c')
-rw-r--r-- | libexec/rshd/rshd.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index 1676ed460a9..72f7958a46d 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rshd.c,v 1.37 2001/05/29 21:37:16 millert Exp $ */ +/* $OpenBSD: rshd.c,v 1.38 2001/06/11 15:18:51 mickey Exp $ */ /*- * Copyright (c) 1988, 1989, 1992, 1993, 1994 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */ -static char *rcsid = "$OpenBSD: rshd.c,v 1.37 2001/05/29 21:37:16 millert Exp $"; +static char *rcsid = "$OpenBSD: rshd.c,v 1.38 2001/06/11 15:18:51 mickey Exp $"; #endif /* not lint */ /* @@ -385,8 +385,7 @@ doit(fromp) if (!use_kerberos) #endif if (check_all || local_domain(saddr)) { - strncpy(remotehost, saddr, sizeof(remotehost) - 1); - remotehost[sizeof(remotehost) - 1] = 0; + strlcpy(remotehost, saddr, sizeof(remotehost)); errorhost = remotehost; memset(&hints, 0, sizeof(hints)); hints.ai_family = fromp->sa_family; @@ -429,15 +428,14 @@ doit(fromp) } } } - hostname = strncpy(hostnamebuf, hostname, - sizeof(hostnamebuf) - 1); + strlcpy(hostnamebuf, hostname, sizeof(hostnamebuf)); + hostname = hostnamebuf; if (res0) freeaddrinfo(res0); } else - errorhost = hostname = strncpy(hostnamebuf, - naddr, sizeof(hostnamebuf) - 1); + strlcpy(hostnamebuf, naddr, sizeof(hostnamebuf)); + errorhost = hostname = hostnamebuf; - hostnamebuf[sizeof(hostnamebuf) - 1] = '\0'; #ifdef KERBEROS if (use_kerberos) { kdata = (AUTH_DAT *) authbuf; |