summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1997-03-24 06:01:39 +0000
committerWarner Losh <imp@FreeBSD.org>1997-03-24 06:01:39 +0000
commit0f5e6a0d00ceae4a48b667b886f3b6338a604f0d (patch)
tree2d13d69f4045f7f118dfeb10403962af22bc716a /libexec
parenta51e2c9b04e5b5b171987a27e83616fe14fae8cf (diff)
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rlogind/rlogind.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index 4a9d7a6d108c..3edba3cc3098 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: rlogind.c,v 1.15 1997/02/22 14:22:08 peter Exp $
*/
#ifndef lint
@@ -226,10 +226,12 @@ doit(f, fromp)
fromp->sin_port = ntohs((u_short)fromp->sin_port);
hp = gethostbyaddr((char *)&fromp->sin_addr, sizeof(struct in_addr),
fromp->sin_family);
- if (hp)
- (void)strcpy(hostname, hp->h_name);
- else
- (void)strcpy(hostname, inet_ntoa(fromp->sin_addr));
+ if (hp) {
+ (void)strncpy(hostname, hp->h_name, sizeof(hostname));
+ } else {
+ (void)strncpy(hostname, inet_ntoa(fromp->sin_addr), sizeof(hostname));
+ }
+ hostname[sizeof(hostname) - 1] = '\0';
#ifdef KERBEROS
if (use_kerberos) {