From: deraadt Date: Sun, 6 Apr 1997 09:13:02 +0000 (+0000) Subject: strncpy X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=00dc71ada92901bfe4a9ee2f0331d383549f5a2c;p=openbsd strncpy --- 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;