From 00dc71ada92901bfe4a9ee2f0331d383549f5a2c Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 6 Apr 1997 09:13:02 +0000 Subject: [PATCH] strncpy --- lib/libc/rpc/clnt_simple.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index bc127b03d9a..1ecd963fa87 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -1,3 +1,4 @@ + /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -28,7 +29,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: clnt_simple.c,v 1.6 1996/12/10 07:46:33 deraadt Exp $"; +static char *rcsid = "$OpenBSD: clnt_simple.c,v 1.7 1997/04/06 09:13:02 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -102,7 +103,8 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) crp->valid = 1; crp->oldprognum = prognum; crp->oldversnum = versnum; - (void) strcpy(crp->oldhost, host); + (void) strncpy(crp->oldhost, host, MAXHOSTNAMELEN-1); + crp->oldhost[MAXHOSTNAMELEN-1] = '\0'; } tottimeout.tv_sec = 25; tottimeout.tv_usec = 0; -- 2.20.1