summaryrefslogtreecommitdiff
path: root/usr.bin/rdistd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-05 20:31:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-05 20:31:59 +0000
commita30a19e6bb8e1cd59f6c8994d4be6856c7f06209 (patch)
tree75b9e4bf6b5fa6143d827012d0e0f8e8ec615832 /usr.bin/rdistd
parentd3a24c7fdcc3cdc9bdd398b0050e46b32597dcdf (diff)
strings; ok miod ho krw
Diffstat (limited to 'usr.bin/rdistd')
-rw-r--r--usr.bin/rdistd/filesys-os.c7
-rw-r--r--usr.bin/rdistd/filesys.c12
-rw-r--r--usr.bin/rdistd/server.c34
3 files changed, 29 insertions, 24 deletions
diff --git a/usr.bin/rdistd/filesys-os.c b/usr.bin/rdistd/filesys-os.c
index 490510c7154..449dd124f4d 100644
--- a/usr.bin/rdistd/filesys-os.c
+++ b/usr.bin/rdistd/filesys-os.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys-os.c,v 1.6 1999/02/04 23:18:57 millert Exp $ */
+/* $OpenBSD: filesys-os.c,v 1.7 2003/04/05 20:31:58 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -39,7 +39,7 @@ static char RCSid[] =
"$From: filesys-os.c,v 6.17 1996/01/17 21:02:45 mcooper Exp mcooper $";
#else
static char RCSid[] =
-"$OpenBSD: filesys-os.c,v 1.6 1999/02/04 23:18:57 millert Exp $";
+"$OpenBSD: filesys-os.c,v 1.7 2003/04/05 20:31:58 deraadt Exp $";
#endif
static char sccsid[] = "@(#)filesys-os.c";
@@ -193,7 +193,8 @@ mntent_t *getmountent(fptr)
mntstruct.me_flags |= MEFLAG_READONLY;
#endif
if (f_type_eq(mnt, MOUNT_NFS)) {
- (void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
+ (void) snprintf(remote_dev, sizeof remote_dev,
+ "%s", mnt->f_mntfromname);
mntstruct.me_path = remote_dev;
mntstruct.me_type = METYPE_NFS;
} else {
diff --git a/usr.bin/rdistd/filesys.c b/usr.bin/rdistd/filesys.c
index 198cb3ffd5c..4ec9c0c56b2 100644
--- a/usr.bin/rdistd/filesys.c
+++ b/usr.bin/rdistd/filesys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys.c,v 1.7 2001/11/19 19:02:15 mpech Exp $ */
+/* $OpenBSD: filesys.c,v 1.8 2003/04/05 20:31:58 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -39,7 +39,7 @@ static char RCSid[] =
"$From: filesys.c,v 6.24 1996/01/30 01:57:07 mcooper Exp $";
#else
static char RCSid[] =
-"$OpenBSD: filesys.c,v 1.7 2001/11/19 19:02:15 mpech Exp $";
+"$OpenBSD: filesys.c,v 1.8 2003/04/05 20:31:58 deraadt Exp $";
#endif
static char sccsid[] = "@(#)filesys.c";
@@ -100,18 +100,18 @@ char *find_file(pathname, statbuf, isvalid)
/*
* Save for next time
*/
- (void) strcpy(last_pathname, pathname);
+ (void) strlcpy(last_pathname, pathname, sizeof last_pathname);
if (*pathname == '/')
- (void) strcpy(file, pathname);
+ (void) strlcpy(file, pathname, sizeof file);
else {
/*
* Ensure we have a directory (".") in our path
* so we have something to stat in case the file
* does not exist.
*/
- (void) strcpy(file, "./");
- (void) strcat(file, pathname);
+ (void) strlcpy(file, "./", sizeof file);
+ (void) strlcat(file, pathname, sizeof file);
}
while (lstat(file, &filestat) != 0) {
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index 833cb29108b..e156b045e35 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.10 2001/11/19 19:02:15 mpech Exp $ */
+/* $OpenBSD: server.c,v 1.11 2003/04/05 20:31:58 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -38,7 +38,7 @@ static char RCSid[] =
"$From: server.c,v 6.85 1996/03/12 22:55:38 mcooper Exp $";
#else
static char RCSid[] =
-"$OpenBSD: server.c,v 1.10 2001/11/19 19:02:15 mpech Exp $";
+"$OpenBSD: server.c,v 1.11 2003/04/05 20:31:58 deraadt Exp $";
#endif
static char sccsid[] = "@(#)server.c 5.3 (Berkeley) 6/7/86";
@@ -221,7 +221,7 @@ static int fchog(fd, file, owner, group, mode)
} else {
uid = last_uid = pw->pw_uid;
primegid = last_primegid = pw->pw_gid;
- strcpy(last_owner, owner);
+ strlcpy(last_owner, owner, sizeof last_owner);
}
} else {
uid = last_uid;
@@ -253,7 +253,7 @@ static int fchog(fd, file, owner, group, mode)
*/
if ((gr = mygetgroup(group))) {
last_gid = gid = gr->gr_gid;
- strcpy(last_group, gr->gr_name);
+ strlcpy(last_group, gr->gr_name, sizeof last_group);
} else {
if (mode != -1 && IS_ON(mode, S_ISGID)) {
message(MT_NOTICE,
@@ -528,12 +528,12 @@ static void docmdspecial()
if (env == NULL) {
len = (2 * sizeof(E_FILES)) + strlen(cp) + 10;
env = (char *) xmalloc(len);
- (void) sprintf(env, "export %s;%s=%s",
+ (void) snprintf(env, len, "export %s;%s=%s",
E_FILES, E_FILES, cp);
} else {
len = strlen(env);
env = (char *) xrealloc(env,
- len + strlen(cp) + 2);
+ len + strlen(cp) + 2);
env[len] = CNULL;
(void) strcat(env, ":");
(void) strcat(env, cp);
@@ -710,7 +710,7 @@ static char *savetarget(file)
return(NULL);
}
- (void) sprintf(savefile, "%s%s", file, SAVE_SUFFIX);
+ (void) snprintf(savefile, sizeof savefile, "%s%s", file, SAVE_SUFFIX);
if (unlink(savefile) != 0 && errno != ENOENT) {
message(MT_NOTICE, "%s: remove failed: %s", savefile, SYSERR);
@@ -1045,7 +1045,8 @@ static void recvdir(opts, mode, owner, group)
opts;
if ((cp = getusername(stb.st_uid, target, o)))
if (strcmp(owner, cp))
- (void) strcpy(lowner, cp);
+ (void) strlcpy(lowner, cp,
+ sizeof lowner);
}
if (!IS_ON(opts, DO_NOCHKGROUP) && group) {
int o;
@@ -1054,7 +1055,8 @@ static void recvdir(opts, mode, owner, group)
opts;
if ((cp = getgroupname(stb.st_gid, target, o)))
if (strcmp(group, cp))
- (void) strcpy(lgroup, cp);
+ (void) strlcpy(lgroup, cp,
+ sizeof lgroup);
}
/*
@@ -1065,11 +1067,13 @@ static void recvdir(opts, mode, owner, group)
if (lowner[0] == CNULL &&
(cp = getusername(stb.st_uid,
target, opts)))
- (void) strcpy(lowner, cp);
+ (void) strlcpy(lowner, cp,
+ sizeof lowner);
if (lgroup[0] == CNULL &&
(cp = getgroupname(stb.st_gid,
target, opts)))
- (void) strcpy(lgroup, cp);
+ (void) strlcpy(lgroup, cp,
+ sizeof lgroup);
if (IS_ON(opts, DO_VERIFY))
message(MT_NOTICE,
@@ -1469,12 +1473,12 @@ static void recvit(cmd, type)
}
file = strrchr(target, '/');
if (file == NULL)
- (void) strcpy(new, tempname);
+ (void) strlcpy(new, tempname, sizeof new);
else if (file == target)
- (void) sprintf(new, "/%s", tempname);
+ (void) snprintf(new, sizeof new, "/%s", tempname);
else {
*file = CNULL;
- (void) sprintf(new, "%s/%s", target, tempname);
+ (void) snprintf(new, sizeof new, "%s/%s", target, tempname);
*file = '/';
}
(void) mktemp(new);
@@ -1596,7 +1600,7 @@ extern void server()
(void) signal(SIGTERM, sighandler);
(void) signal(SIGPIPE, sighandler);
(void) umask(oumask = umask(0));
- (void) strcpy(tempname, _RDIST_TMP);
+ (void) strlcpy(tempname, _RDIST_TMP, sizeof tempname);
if (fromhost) {
message(MT_SYSLOG, "Startup for %s", fromhost);
#if defined(SETARGS)