summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-27 03:33:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-27 03:33:58 +0000
commit3e8cde4631e0295486eb6b32fd2bacc268f5c3b3 (patch)
treee09520ecdac2fbd3cfa7ed533ec329aee0011771 /lib
parent7299897e474ec70fa715c574d2703640a352705a (diff)
use strncpy correctly
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/getrpcent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c
index f0b0b91ae63..ab555062553 100644
--- a/lib/libc/rpc/getrpcent.c
+++ b/lib/libc/rpc/getrpcent.c
@@ -29,7 +29,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: getrpcent.c,v 1.3 1996/08/19 08:31:34 tholo Exp $";
+static char *rcsid = "$OpenBSD: getrpcent.c,v 1.4 1996/08/27 03:33:57 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -165,7 +165,8 @@ interpret(val, len)
if (d == 0)
return (0);
- (void) strncpy(d->line, val, len);
+ (void) strncpy(d->line, val, len-1);
+ d->line[len-1] = '\0';
p = d->line;
d->line[len] = '\n';
if (*p == '#')