diff options
author | imp <imp@FreeBSD.org> | 1998-06-09 04:10:08 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-06-09 04:10:08 +0000 |
commit | 41a9e1ce2d103396468b07dce9965543cd39f4db (patch) | |
tree | ca543152855926f88ede31b4e3ad1547a44c5865 /usr.bin/rdist/server.c | |
parent | 276491a1c64f083aea60c7a82138eedcef34afd5 (diff) | |
download | FreeBSD-src-41a9e1ce2d103396468b07dce9965543cd39f4db.zip FreeBSD-src-41a9e1ce2d103396468b07dce9965543cd39f4db.tar.gz |
Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.
Inspired by: OpenBSD's changes in this area by theo de raadt
Diffstat (limited to 'usr.bin/rdist/server.c')
-rw-r--r-- | usr.bin/rdist/server.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/rdist/server.c b/usr.bin/rdist/server.c index 98b1e4a..d91d723 100644 --- a/usr.bin/rdist/server.c +++ b/usr.bin/rdist/server.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93"; #endif static const char rcsid[] = - "$Id: server.c,v 1.7 1998/04/06 06:18:32 charnier Exp $"; + "$Id: server.c,v 1.8 1998/04/20 06:20:24 charnier Exp $"; #endif /* not lint */ #include <sys/wait.h> @@ -473,7 +473,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); @@ -870,7 +870,7 @@ recvf(cmd, type) if (opts & COMPARE) { char tbuf[BUFSIZ]; - if ((i = readlink(target, tbuf, BUFSIZ)) >= 0 && + if ((i = readlink(target, tbuf, BUFSIZ - 1)) >= 0 && i == size && strncmp(buf, tbuf, size) == 0) { (void) unlink(new); ack(); |