summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-04-07 23:45:46 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-04-07 23:45:46 +0000
commit4da2438d6e514bb04c72d0a9f8f6b301bb07d16d (patch)
tree34bb2dfb5262626cf484a590e6e9c48398b39e67
parentbce4c1db171f856ff2b89e768b57c12faf1aadd3 (diff)
strcpy -> strlcpy. some from and ok deraadt@
-rw-r--r--usr.sbin/amd/amd/host_ops.c4
-rw-r--r--usr.sbin/amd/amd/nfs_ops.c6
-rw-r--r--usr.sbin/amd/amd/opts.c13
-rw-r--r--usr.sbin/amd/fsinfo/fsi_analyze.c5
4 files changed, 14 insertions, 14 deletions
diff --git a/usr.sbin/amd/amd/host_ops.c b/usr.sbin/amd/amd/host_ops.c
index 006846719b1..438bfc38379 100644
--- a/usr.sbin/amd/amd/host_ops.c
+++ b/usr.sbin/amd/amd/host_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: host_ops.c,v 1.11 2003/04/04 00:43:17 deraadt Exp $ */
+/* $OpenBSD: host_ops.c,v 1.12 2003/04/07 23:45:45 tedu Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -363,7 +363,7 @@ host_fmount(mntfs *mf)
for (j = 0; j < n_export; j++) {
ex = ep[j];
if (ex) {
- strcpy(rfs_dir, ex->ex_dir);
+ strlcpy(rfs_dir, ex->ex_dir, fs_name + sizeof fs_name - rfs_dir);
MAKE_MNTPT(mntpt, ex, mf);
if (do_mount(&fp[j], mntpt, fs_name, mf->mf_mopts, mf) == 0)
ok = TRUE;
diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c
index f0c21e4aba6..8cf18b88d8c 100644
--- a/usr.sbin/amd/amd/nfs_ops.c
+++ b/usr.sbin/amd/amd/nfs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_ops.c,v 1.16 2002/08/05 07:24:26 pvalchev Exp $ */
+/* $OpenBSD: nfs_ops.c,v 1.17 2003/04/07 23:45:45 tedu Exp $ */
/*-
* Copyright (c) 1990 Jan-Simon Pendry
@@ -40,7 +40,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)nfs_ops.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.16 2002/08/05 07:24:26 pvalchev Exp $";
+static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.17 2003/04/07 23:45:45 tedu Exp $";
#endif /* not lint */
#include "am.h"
@@ -534,7 +534,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
* Most kernels have a name length restriction.
*/
if (strlen(host) >= HOSTNAMESZ)
- strcpy(host + HOSTNAMESZ - 3, "..");
+ strlcpy(host + HOSTNAMESZ - 3, "..", sizeof host - HOSTNAMESZ + 3);
#endif /* HOSTNAMESZ */
if ((nfs_args.rsize = hasmntval(&mnt, "rsize")))
diff --git a/usr.sbin/amd/amd/opts.c b/usr.sbin/amd/amd/opts.c
index 59fd72cabaa..41a67d39b73 100644
--- a/usr.sbin/amd/amd/opts.c
+++ b/usr.sbin/amd/amd/opts.c
@@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)opts.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: opts.c,v 1.6 2002/11/25 18:04:10 pvalchev Exp $";
+static char *rcsid = "$Id: opts.c,v 1.7 2003/04/07 23:45:45 tedu Exp $";
#endif /* not lint */
#include "am.h"
@@ -576,8 +576,8 @@ static char expand_error[] = "No space to expand \"%s\"";
/*dlog("Expanding \"%s\" to \"%s\"", nbuf, val);*/
#endif /* DEBUG */
if (BUFSPACE(ep, vlen)) {
- strcpy(ep, vptr);
- ep += vlen;
+ strlcpy(ep, vptr, expbuf + sizeof expbuf - ep);
+ ep += strlen(ep);
} else {
plog(XLOG_ERROR, expand_error, *p->opt);
goto out;
@@ -603,8 +603,8 @@ static char expand_error[] = "No space to expand \"%s\"";
int vlen = strlen(env);
if (BUFSPACE(ep, vlen)) {
- strcpy(ep, env);
- ep += vlen;
+ strlcpy(ep, env, expbuf + sizeof expbuf - ep);
+ ep += strlen(ep);
} else {
plog(XLOG_ERROR, expand_error, *p->opt);
goto out;
@@ -636,8 +636,7 @@ out:
* Finish off the expansion
*/
if (BUFSPACE(ep, strlen(cp))) {
- strcpy(ep, cp);
- /*ep += strlen(ep);*/
+ strlcpy(ep, cp, envbuf + sizeof expbuf - ep);
} else {
plog(XLOG_ERROR, expand_error, *p->opt);
}
diff --git a/usr.sbin/amd/fsinfo/fsi_analyze.c b/usr.sbin/amd/fsinfo/fsi_analyze.c
index 545eaae7243..c0deb7d0ff9 100644
--- a/usr.sbin/amd/fsinfo/fsi_analyze.c
+++ b/usr.sbin/amd/fsinfo/fsi_analyze.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)fsi_analyze.c 8.1 (Berkeley) 6/6/93
- * $Id: fsi_analyze.c,v 1.3 2002/06/11 05:29:55 itojun Exp $
+ * $Id: fsi_analyze.c,v 1.4 2003/04/07 23:45:45 tedu Exp $
*/
/*
@@ -114,6 +114,7 @@ char *hn;
char *p = strdup(hn);
char *d;
char path[MAXPATHLEN];
+ size_t len = strlen(p) + 1;
domain_strip(p, hostname);
path[0] = '\0';
@@ -131,7 +132,7 @@ char *hn;
log("hostpath of '%s' is '%s'", hn, path);
- strcpy(p, path);
+ strlcpy(p, path, len);
return p;
}