summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-07 21:13:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-07 21:13:55 +0000
commit05325cbf2cd782c5388d92a0023e6ec0b1292641 (patch)
tree6f33c59185acb04605fe514c61eb613674481da1
parentb236858cae71da07b39c9bf332ce1b65fde49767 (diff)
replace strcpy calls that got inlined by gcc; Hans-Joerg.Hoexer@yerbouti.franken.de
-rw-r--r--usr.bin/ctags/ctags.c8
-rw-r--r--usr.bin/file/compress.c4
-rw-r--r--usr.bin/msgs/msgs.c8
-rw-r--r--usr.bin/rdist/client.c19
-rw-r--r--usr.bin/skeyinit/skeyinit.c10
-rw-r--r--usr.bin/ul/ul.c7
-rw-r--r--usr.bin/vi/common/options.c4
7 files changed, 30 insertions, 30 deletions
diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c
index 5abe78d1f98..bb69b3aa7a6 100644
--- a/usr.bin/ctags/ctags.c
+++ b/usr.bin/ctags/ctags.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctags.c,v 1.6 2002/02/16 21:27:45 millert Exp $ */
+/* $OpenBSD: ctags.c,v 1.7 2003/04/07 21:13:54 deraadt Exp $ */
/* $NetBSD: ctags.c,v 1.4 1995/09/02 05:57:23 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95";
#endif
-static char rcsid[] = "$OpenBSD: ctags.c,v 1.6 2002/02/16 21:27:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: ctags.c,v 1.7 2003/04/07 21:13:54 deraadt Exp $";
#endif /* not lint */
#include <err.h>
@@ -261,7 +261,7 @@ find_entries(file)
* for C references. This may be wrong.
*/
toss_yysec();
- (void)strcpy(lbuf, "%%$");
+ (void)strlcpy(lbuf, "%%$", sizeof lbuf);
pfnote("yylex", lineno);
rewind(inf);
}
@@ -272,7 +272,7 @@ find_entries(file)
* for C references. This may be wrong.
*/
toss_yysec();
- (void)strcpy(lbuf, "%%$");
+ (void)strlcpy(lbuf, "%%$", sizeof lbuf);
pfnote("yyparse", lineno);
y_entries();
}
diff --git a/usr.bin/file/compress.c b/usr.bin/file/compress.c
index 71a64c15521..39e93934a12 100644
--- a/usr.bin/file/compress.c
+++ b/usr.bin/file/compress.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compress.c,v 1.7 2003/03/11 21:26:26 ian Exp $ */
+/* $OpenBSD: compress.c,v 1.8 2003/04/07 21:13:54 deraadt Exp $ */
/*
* compress routines:
@@ -161,7 +161,7 @@ pipe2file(int fd, void *startbuf, size_t nbytes)
char buf[4096];
int r, tfd;
- (void)strcpy(buf, "/tmp/file.XXXXXX");
+ (void)strlcpy(buf, "/tmp/file.XXXXXX", sizeof buf);
#ifndef HAVE_MKSTEMP
{
char *ptr = mktemp(buf);
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index 15f6ce22eb5..0decb021d69 100644
--- a/usr.bin/msgs/msgs.c
+++ b/usr.bin/msgs/msgs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msgs.c,v 1.24 2003/03/13 09:09:33 deraadt Exp $ */
+/* $OpenBSD: msgs.c,v 1.25 2003/04/07 21:13:54 deraadt Exp $ */
/* $NetBSD: msgs.c,v 1.7 1995/09/28 06:57:40 tls Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: msgs.c,v 1.24 2003/03/13 09:09:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: msgs.c,v 1.25 2003/04/07 21:13:54 deraadt Exp $";
#endif
#endif /* not lint */
@@ -802,11 +802,11 @@ ask(prompt)
fname[n] = NULL;
}
else
- strcpy(fname, "Messages");
+ strlcpy(fname, "Messages", sizeof fname);
fd = open(fname, O_RDWR|O_EXCL|O_CREAT|O_APPEND, 0666);
}
else {
- strcpy(fname, _PATH_TMPFILE);
+ strlcpy(fname, _PATH_TMPFILE, sizeof fname);
fd = mkstemp(fname);
if (fd != -1) {
snprintf(cmdbuf, sizeof(cmdbuf), _PATH_MAIL, fname);
diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c
index 472a068ff60..eba72701151 100644
--- a/usr.bin/rdist/client.c
+++ b/usr.bin/rdist/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.14 2003/04/05 20:31:58 deraadt Exp $ */
+/* $OpenBSD: client.c,v 1.15 2003/04/07 21:13:52 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -39,7 +39,7 @@ static char RCSid[] =
"$From: client.c,v 6.80 1996/02/28 20:34:27 mcooper Exp $";
#else
static char RCSid[] =
-"$OpenBSD: client.c,v 1.14 2003/04/05 20:31:58 deraadt Exp $";
+"$OpenBSD: client.c,v 1.15 2003/04/07 21:13:52 deraadt Exp $";
#endif
static char sccsid[] = "@(#)client.c";
@@ -134,7 +134,7 @@ char *remfilename(src, dest, path, rname, destdir)
"%s%s", dest, cp);
}
} else
- strcpy(lname, dest);
+ strlcpy(lname, dest, buf + sizeof buff - lname);
debugmsg(DM_MISC, "remfilename: remote filename=%s\n", lname);
@@ -362,7 +362,6 @@ static int sendhardlink(opts, lp, rname, destdir)
int destdir;
{
static char buff[MAXPATHLEN];
- char *lname; /* name of file to link to */
debugmsg(DM_MISC,
"sendhardlink: rname='%s' pathname='%s' src='%s' target='%s'\n",
@@ -373,13 +372,11 @@ static int sendhardlink(opts, lp, rname, destdir)
(void) sendcmd(C_RECVHARDLINK, "%o %s %s",
opts, lp->pathname, rname);
else {
- lname = buff;
- strcpy(lname, remfilename(lp->src, lp->target,
- lp->pathname, rname,
- destdir));
- debugmsg(DM_MISC, "sendhardlink: lname=%s\n", lname);
+ strlcpy(buff, remfilename(lp->src, lp->target,
+ lp->pathname, rname, destdir), sizeof buff);
+ debugmsg(DM_MISC, "sendhardlink: lname=%s\n", buff);
(void) sendcmd(C_RECVHARDLINK, "%o %s %s",
- opts, lname, rname);
+ opts, buff, rname);
}
return(response());
@@ -1192,7 +1189,7 @@ extern int install(src, dest, ddir, destdir, opts)
if (IS_ON(opts, DO_WHOLE))
source[0] = CNULL;
else
- (void) strcpy(source, src);
+ (void) strlcpy(source, src, sizeof source);
if (dest == NULL) {
FLAG_OFF(opts, DO_WHOLE); /* WHOLE only useful if renaming */
diff --git a/usr.bin/skeyinit/skeyinit.c b/usr.bin/skeyinit/skeyinit.c
index f6c44726904..92f944eda66 100644
--- a/usr.bin/skeyinit/skeyinit.c
+++ b/usr.bin/skeyinit/skeyinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: skeyinit.c,v 1.42 2003/04/06 21:07:38 deraadt Exp $ */
+/* $OpenBSD: skeyinit.c,v 1.43 2003/04/07 21:13:54 deraadt Exp $ */
/* OpenBSD S/Key (skeyinit.c)
*
@@ -255,11 +255,13 @@ purpose of using S/Key in the fist place.\n");
if (l > 0) {
lastc = skey.seed[l - 1];
if (isdigit(lastc) && lastc != '9') {
- (void)strcpy(seed, skey.seed);
+ (void)strlcpy(seed, skey.seed,
+ sizeof seed);
seed[l - 1] = lastc + 1;
}
if (isdigit(lastc) && lastc == '9' && l < 16) {
- (void)strcpy(seed, skey.seed);
+ (void)strlcpy(seed, skey.seed,
+ sizeof seed);
seed[l - 1] = '0';
seed[l] = '0';
seed[l + 1] = '\0';
@@ -371,7 +373,7 @@ secure_mode(int *count, char *key, char *seed, char *buf, size_t bufsiz)
break; /* Valid seed */
}
if (newseed[0] != '\0')
- (void)strcpy(seed, newseed);
+ (void)strlcpy(seed, newseed, sizeof seed);
for (i = 0; ; i++) {
if (i >= 2)
diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c
index 8da3a1dc3c9..13364fe981e 100644
--- a/usr.bin/ul/ul.c
+++ b/usr.bin/ul/ul.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ul.c,v 1.7 2001/11/19 19:02:17 mpech Exp $ */
+/* $OpenBSD: ul.c,v 1.8 2003/04/07 21:13:54 deraadt Exp $ */
/* $NetBSD: ul.c,v 1.3 1994/12/07 00:28:24 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ul.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: ul.c,v 1.7 2001/11/19 19:02:17 mpech Exp $";
+static char rcsid[] = "$OpenBSD: ul.c,v 1.8 2003/04/07 21:13:54 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -149,7 +149,8 @@ main(argc, argv)
case 0:
/* No such terminal type - assume dumb */
- (void)strcpy(termcap, "dumb:os:col#80:cr=^M:sf=^J:am:");
+ (void)strlcpy(termcap, "dumb:os:col#80:cr=^M:sf=^J:am:",
+ sizeof termcap);
break;
}
initcap();
diff --git a/usr.bin/vi/common/options.c b/usr.bin/vi/common/options.c
index f80a6f81df7..71bd0c41a44 100644
--- a/usr.bin/vi/common/options.c
+++ b/usr.bin/vi/common/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.10 2002/02/16 21:27:57 millert Exp $ */
+/* $OpenBSD: options.c,v 1.11 2003/04/07 21:13:54 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -303,7 +303,7 @@ opts_init(sp, oargs)
/* Set numeric and string default values. */
#define OI(indx, str) { \
if (str != b1) /* GCC puts strings in text-space. */ \
- (void)strcpy(b1, str); \
+ (void)strlcpy(b1, str, sizeof b1); \
a.len = strlen(b1); \
if (opts_set(sp, argv, NULL)) { \
optindx = indx; \