summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-18 19:13:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-18 19:13:40 +0000
commitd51d6214fa2abd8ab575dfad3ef0690ab2a096d6 (patch)
treed11a883bf092b8f77001a674d42769deeb1a3367 /usr.bin
parentef77d4ef152a7f3529fa71b2c2eaedb17241d696 (diff)
readlink len-1
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/oldrdist/server.c6
-rw-r--r--usr.bin/rdist/client.c6
-rw-r--r--usr.bin/rdistd/server.c6
-rw-r--r--usr.bin/readlink/readlink.c4
-rw-r--r--usr.bin/sup/src/supcmeat.c4
-rw-r--r--usr.bin/sup/src/supfilesrv.c4
6 files changed, 15 insertions, 15 deletions
diff --git a/usr.bin/oldrdist/server.c b/usr.bin/oldrdist/server.c
index 1f917caba0c..c2bb3a91a02 100644
--- a/usr.bin/oldrdist/server.c
+++ b/usr.bin/oldrdist/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.10 1998/04/27 03:13:53 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.11 1998/05/18 19:13:20 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -35,7 +35,7 @@
#ifndef lint
/* from: static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93"; */
-static char *rcsid = "$OpenBSD: server.c,v 1.10 1998/04/27 03:13:53 deraadt Exp $";
+static char *rcsid = "$OpenBSD: server.c,v 1.11 1998/05/18 19:13:20 deraadt Exp $";
#endif /* not lint */
#include <sys/wait.h>
@@ -475,7 +475,7 @@ sendf(rname, opts)
(void) write(rem, buf, strlen(buf));
if (response() < 0)
return;
- sizerr = (readlink(target, buf, BUFSIZ) != stb.st_size);
+ sizerr = (readlink(target, buf, BUFSIZ-1) != stb.st_size);
(void) write(rem, buf, stb.st_size);
if (debug)
printf("readlink = %.*s\n", (int)stb.st_size, buf);
diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c
index 9392d7ede1b..0ab5c37787c 100644
--- a/usr.bin/rdist/client.c
+++ b/usr.bin/rdist/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.5 1997/07/21 01:53:37 angelos Exp $ */
+/* $OpenBSD: client.c,v 1.6 1998/05/18 19:12:29 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: client.c,v 1.5 1997/07/21 01:53:37 angelos Exp $";
+"$OpenBSD: client.c,v 1.6 1998/05/18 19:12:29 deraadt Exp $";
static char sccsid[] = "@(#)client.c";
@@ -667,7 +667,7 @@ static int sendlink(rname, opts, stb, user, group, destdir)
/*
* Gather and send additional link info
*/
- sizerr = (readlink(target, lbuf, sizeof(lbuf)) != stb->st_size);
+ sizerr = (readlink(target, lbuf, sizeof(lbuf)-1) != stb->st_size);
(void) sprintf(tbuf, "%.*s", (int) stb->st_size, lbuf);
(void) sendcmd(C_NONE, "%s\n", tbuf);
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index f49fc842651..1fd3152adf1 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.5 1996/07/25 05:31:03 millert Exp $ */
+/* $OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,7 +34,7 @@
*/
#ifndef lint
static char RCSid[] =
-"$OpenBSD: server.c,v 1.5 1996/07/25 05:31:03 millert Exp $";
+"$OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $";
static char sccsid[] = "@(#)server.c 5.3 (Berkeley) 6/7/86";
@@ -1162,7 +1162,7 @@ static void recvlink(new, opts, mode, size)
if (IS_ON(opts, DO_COMPARE)) {
char tbuf[MAXPATHLEN];
- if ((i = readlink(target, tbuf, sizeof(tbuf))) >= 0 &&
+ if ((i = readlink(target, tbuf, sizeof(tbuf)-1)) >= 0 &&
i == size && strncmp(buf, tbuf, (int) size) == 0) {
(void) unlink(new);
ack();
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c
index 51abac3dcf6..603d4bb0bcb 100644
--- a/usr.bin/readlink/readlink.c
+++ b/usr.bin/readlink/readlink.c
@@ -1,5 +1,5 @@
/*
- * $OpenBSD: readlink.c,v 1.13 1997/11/18 22:52:10 niklas Exp $
+ * $OpenBSD: readlink.c,v 1.14 1998/05/18 19:12:03 deraadt Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
@@ -71,7 +71,7 @@ main(argc, argv)
if (fflag)
realpath(argv[0], buf);
- else if ((n = readlink(argv[0], buf, PATH_MAX)) < 0)
+ else if ((n = readlink(argv[0], buf, sizeof buf-1)) < 0)
exit(1);
buf[n] = '\0';
diff --git a/usr.bin/sup/src/supcmeat.c b/usr.bin/sup/src/supcmeat.c
index f0cafda6ffa..230cb6a04f8 100644
--- a/usr.bin/sup/src/supcmeat.c
+++ b/usr.bin/sup/src/supcmeat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: supcmeat.c,v 1.8 1997/09/16 11:01:20 deraadt Exp $ */
+/* $OpenBSD: supcmeat.c,v 1.9 1998/05/18 19:13:37 deraadt Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -837,7 +837,7 @@ register struct stat *statp;
}
linkname = t->Tlink->Tname;
if (!new && (t->Tflags&FNEW) == 0 &&
- (n = readlink (t->Tname,buf,sizeof(buf))) >= 0 &&
+ (n = readlink (t->Tname,buf,sizeof(buf)-1)) >= 0 &&
(n == strlen (linkname)) && (strncmp (linkname,buf,n) == 0))
return (FALSE);
if (thisC->Cflags&CFLIST) {
diff --git a/usr.bin/sup/src/supfilesrv.c b/usr.bin/sup/src/supfilesrv.c
index 70150da5040..dae2c03811a 100644
--- a/usr.bin/sup/src/supfilesrv.c
+++ b/usr.bin/sup/src/supfilesrv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: supfilesrv.c,v 1.13 1997/11/17 08:54:05 deraadt Exp $ */
+/* $OpenBSD: supfilesrv.c,v 1.14 1998/05/18 19:13:39 deraadt Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -1057,7 +1057,7 @@ void *v;
}
switch (t->Tmode&S_IFMT) {
case S_IFLNK:
- if ((x = readlink (name,slinkname,STRINGLENGTH)) <= 0) {
+ if ((x = readlink (name,slinkname,STRINGLENGTH-1)) <= 0) {
(void) Tinsert (&denyT,name,FALSE);
return (SCMOK);
}