From c9c371ec3ea85f25cfa5d31144689940d1f769a7 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 28 Jan 2015 14:31:09 +0100 Subject: cvs update --- src/bin/md5/md5.c | 14 ++++++++------ src/usr.bin/lam/lam.c | 4 ++-- src/usr.bin/lndir/lndir.c | 8 ++++---- src/usr.bin/signify/signify.1 | 6 ++++-- src/usr.bin/signify/signify.c | 17 ++++++++++------- src/usr.sbin/rdate/ntp.c | 3 +-- src/usr.sbin/rdate/rdate.c | 3 +-- src/usr.sbin/rdate/rfc868time.c | 3 +-- 8 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/bin/md5/md5.c b/src/bin/md5/md5.c index 9771f2c..0523883 100644 --- a/src/bin/md5/md5.c +++ b/src/bin/md5/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.77 2014/09/13 16:06:36 doug Exp $ */ +/* $OpenBSD: md5.c,v 1.79 2015/01/19 16:43:28 deraadt Exp $ */ /* * Copyright (c) 2001,2003,2005-2007,2010,2013,2014 @@ -49,8 +49,8 @@ #define MAX_DIGEST_LEN 128 -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) union ANY_CTX { #if !defined(SHA2_ONLY) @@ -175,9 +175,9 @@ TAILQ_HEAD(hash_list, hash_function); void digest_end(const struct hash_function *, void *, char *, size_t, int); int digest_file(const char *, struct hash_list *, int); -int digest_filelist(const char *, struct hash_function *, int, char **); void digest_print(const struct hash_function *, const char *, const char *); #if !defined(SHA2_ONLY) +int digest_filelist(const char *, struct hash_function *, int, char **); void digest_printstr(const struct hash_function *, const char *, const char *); void digest_string(char *, struct hash_list *); void digest_test(struct hash_list *); @@ -442,6 +442,7 @@ digest_print(const struct hash_function *hf, const char *what, } } +#if !defined(SHA2_ONLY) void digest_printstr(const struct hash_function *hf, const char *what, const char *digest) @@ -458,6 +459,7 @@ digest_printstr(const struct hash_function *hf, const char *what, break; } } +#endif /* !defined(SHA2_ONLY) */ int digest_file(const char *file, struct hash_list *hl, int echo) @@ -546,8 +548,8 @@ digest_filelist(const char *file, struct hash_function *defhash, int selcount, algorithm_max = algorithm_min = strlen(functions[0].name); for (hf = &functions[1]; hf->name != NULL; hf++) { len = strlen(hf->name); - algorithm_max = MAX(algorithm_max, len); - algorithm_min = MIN(algorithm_min, len); + algorithm_max = MAXIMUM(algorithm_max, len); + algorithm_min = MINIMUM(algorithm_min, len); } error = found = 0; diff --git a/src/usr.bin/lam/lam.c b/src/usr.bin/lam/lam.c index ebdec7a..268998e 100644 --- a/src/usr.bin/lam/lam.c +++ b/src/usr.bin/lam/lam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lam.c,v 1.16 2013/11/20 21:22:17 deraadt Exp $ */ +/* $OpenBSD: lam.c,v 1.17 2015/01/16 06:40:09 deraadt Exp $ */ /* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */ /*- @@ -35,7 +35,7 @@ * Author: John Kunze, UCB */ -#include +#include /* NOFILE_MAX */ #include #include diff --git a/src/usr.bin/lndir/lndir.c b/src/usr.bin/lndir/lndir.c index bdc5e78..42ed8e0 100644 --- a/src/usr.bin/lndir/lndir.c +++ b/src/usr.bin/lndir/lndir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lndir.c,v 1.20 2014/05/20 01:25:23 guenther Exp $ */ +/* $OpenBSD: lndir.c,v 1.21 2015/01/16 06:40:09 deraadt Exp $ */ /* $XConsortium: lndir.c /main/15 1995/08/30 10:56:18 gildea $ */ /* @@ -47,7 +47,6 @@ in this Software without prior written authorization from the X Consortium. % lndir ../X */ -#include #include #include @@ -58,6 +57,7 @@ in this Software without prior written authorization from the X Consortium. #include #include #include +#include extern char *__progname; @@ -179,8 +179,8 @@ addexcept(char *name) int dodir(char *fn, struct stat *fs, struct stat *ts, int rel) { - char buf[MAXPATHLEN + 1], symbuf[MAXPATHLEN + 1]; - char basesym[MAXPATHLEN + 1]; + char buf[PATH_MAX + 1], symbuf[PATH_MAX + 1]; + char basesym[PATH_MAX + 1]; int n_dirs, symlen, basesymlen = -1; struct stat sb, sc; struct except *cur; diff --git a/src/usr.bin/signify/signify.1 b/src/usr.bin/signify/signify.1 index 5ffe509..b2ac679 100644 --- a/src/usr.bin/signify/signify.1 +++ b/src/usr.bin/signify/signify.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: signify.1,v 1.29 2015/01/07 10:29:22 florian Exp $ +.\" $OpenBSD: signify.1,v 1.30 2015/01/20 20:50:36 tedu Exp $ .\" .\"Copyright (c) 2013 Marc Espie .\"Copyright (c) 2013 Ted Unangst @@ -14,7 +14,7 @@ .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.Dd $Mdocdate: January 7 2015 $ +.Dd $Mdocdate: January 20 2015 $ .Dt SIGNIFY 1 .Os .Sh NAME @@ -164,3 +164,5 @@ The .Nm command first appeared in .Ox 5.5 . +.Sh AUTHORS +.An Ted Unangst Aq Mt tedu@openbsd.org diff --git a/src/usr.bin/signify/signify.c b/src/usr.bin/signify/signify.c index 7f13eca..06d28da 100644 --- a/src/usr.bin/signify/signify.c +++ b/src/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.96 2015/01/07 19:53:34 tedu Exp $ */ +/* $OpenBSD: signify.c,v 1.100 2015/01/16 06:16:12 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -179,7 +180,7 @@ readmsg(const char *filename, unsigned long long *msglenp) errx(1, "msg too large in %s", filename); space = sb.st_size + 1; } else { - space = 64 * 1024; + space = 64 * 1024 - 1; } msg = xmalloc(space + 1); @@ -507,7 +508,7 @@ verify(const char *pubkeyfile, const char *msgfile, const char *sigfile, #ifndef VERIFYONLY #define HASHBUFSIZE 224 struct checksum { - char file[1024]; + char file[PATH_MAX]; char hash[HASHBUFSIZE]; char algo[32]; }; @@ -591,11 +592,13 @@ verifychecksums(char *msg, int argc, char **argv, int quiet) while (line && *line) { if ((endline = strchr(line, '\n'))) *endline++ = '\0'; - rv = sscanf(line, "%31s (%1023s = %223s", +#if PATH_MAX < 1024 || HASHBUFSIZE < 224 +#error sizes are wrong +#endif + rv = sscanf(line, "%31s (%1023[^)]) = %223s", c.algo, c.file, c.hash); - if (rv != 3 || c.file[0] == 0 || c.file[strlen(c.file)-1] != ')') + if (rv != 3) errx(1, "unable to parse checksum line %s", line); - c.file[strlen(c.file) - 1] = '\0'; line = endline; if (argc) { slot = ohash_qlookup(&myh, c.file); @@ -647,7 +650,7 @@ main(int argc, char **argv) { const char *pubkeyfile = NULL, *seckeyfile = NULL, *msgfile = NULL, *sigfile = NULL; - char sigfilebuf[1024]; + char sigfilebuf[PATH_MAX]; const char *comment = "signify"; int ch, rounds; int embedded = 0; diff --git a/src/usr.sbin/rdate/ntp.c b/src/usr.sbin/rdate/ntp.c index e06f236..688436a 100644 --- a/src/usr.sbin/rdate/ntp.c +++ b/src/usr.sbin/rdate/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.32 2014/10/29 04:00:44 deraadt Exp $ */ +/* $OpenBSD: ntp.c,v 1.33 2015/01/16 06:40:20 deraadt Exp $ */ /* * Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved. @@ -29,7 +29,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include diff --git a/src/usr.sbin/rdate/rdate.c b/src/usr.sbin/rdate/rdate.c index 1c503dc..d14bb78 100644 --- a/src/usr.sbin/rdate/rdate.c +++ b/src/usr.sbin/rdate/rdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rdate.c,v 1.30 2013/11/12 22:27:13 deraadt Exp $ */ +/* $OpenBSD: rdate.c,v 1.31 2015/01/16 06:40:20 deraadt Exp $ */ /* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */ /* @@ -38,7 +38,6 @@ * midnight January 1st 1900. */ -#include #include #include diff --git a/src/usr.sbin/rdate/rfc868time.c b/src/usr.sbin/rdate/rfc868time.c index 7f1b23b..be97fcd 100644 --- a/src/usr.sbin/rdate/rfc868time.c +++ b/src/usr.sbin/rdate/rfc868time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfc868time.c,v 1.9 2013/11/12 22:27:13 deraadt Exp $ */ +/* $OpenBSD: rfc868time.c,v 1.10 2015/01/16 06:40:20 deraadt Exp $ */ /* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */ /* @@ -39,7 +39,6 @@ * midnight January 1st 1900. */ -#include #include #include #include -- cgit 1.4.1