Browse Source

Move to the <limits.h> universe.

review by millert, binary checking process with doug, concept with guenther
OPENBSD_5_7
deraadt 10 years ago
parent
commit
75d428b273
9 changed files with 21 additions and 23 deletions
  1. +1
    -2
      src/lib/libc/crypt/arc4random.c
  2. +1
    -2
      src/lib/libc/crypt/crypt.c
  3. +5
    -3
      src/lib/libc/hash/helper.c
  4. +2
    -2
      src/lib/libc/hash/sha1.c
  5. +2
    -2
      src/lib/libc/hash/siphash.c
  6. +2
    -2
      src/lib/libc/stdlib/malloc.c
  7. +1
    -4
      src/lib/libc/stdlib/random.c
  8. +3
    -3
      src/lib/libc/stdlib/realpath.c
  9. +4
    -3
      src/lib/libutil/readlabel.c

+ 1
- 2
src/lib/libc/crypt/arc4random.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random.c,v 1.51 2015/01/15 06:57:18 deraadt Exp $ */
/* $OpenBSD: arc4random.c,v 1.52 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -31,7 +31,6 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h> #include <sys/time.h>
#define KEYSTREAM_ONLY #define KEYSTREAM_ONLY


+ 1
- 2
src/lib/libc/crypt/crypt.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: crypt.c,v 1.25 2014/12/08 20:36:18 tedu Exp $ */
/* $OpenBSD: crypt.c,v 1.26 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* FreeSec: libcrypt * FreeSec: libcrypt
@ -47,7 +47,6 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>


+ 5
- 3
src/lib/libc/hash/helper.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: helper.c,v 1.12 2015/01/15 13:05:59 millert Exp $ */
/* $OpenBSD: helper.c,v 1.13 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org> * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@ -21,7 +21,7 @@
* can buy me a beer in return. Poul-Henning Kamp * can buy me a beer in return. Poul-Henning Kamp
*/ */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
@ -33,6 +33,8 @@
#include <hashinc> #include <hashinc>
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
/* ARGSUSED */ /* ARGSUSED */
char * char *
HASHEnd(HASH_CTX *ctx, char *buf) HASHEnd(HASH_CTX *ctx, char *buf)
@ -79,7 +81,7 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len)
return (NULL); return (NULL);
} }
while ((nr = read(fd, buffer, MIN(sizeof(buffer), len))) > 0) {
while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
HASHUpdate(&ctx, buffer, (size_t)nr); HASHUpdate(&ctx, buffer, (size_t)nr);
if (len > 0 && (len -= nr) == 0) if (len > 0 && (len -= nr) == 0)
break; break;


+ 2
- 2
src/lib/libc/hash/sha1.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: sha1.c,v 1.24 2015/01/15 13:05:59 millert Exp $ */
/* $OpenBSD: sha1.c,v 1.25 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* SHA-1 in C * SHA-1 in C
@ -14,7 +14,7 @@
* 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
*/ */
#include <sys/param.h>
#include <sys/types.h>
#include <string.h> #include <string.h>
#include <sha1.h> #include <sha1.h>


+ 2
- 2
src/lib/libc/hash/siphash.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: siphash.c,v 1.1 2014/12/08 20:37:11 tedu Exp $ */
/* $OpenBSD: siphash.c,v 1.2 2015/01/16 16:48:51 deraadt Exp $ */
/*- /*-
* Copyright (c) 2013 Andre Oppermann <andre@FreeBSD.org> * Copyright (c) 2013 Andre Oppermann <andre@FreeBSD.org>
@ -43,7 +43,7 @@
* https://131002.net/siphash/ * https://131002.net/siphash/
*/ */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/endian.h> #include <sys/endian.h>
#include <string.h> #include <string.h>


+ 2
- 2
src/lib/libc/stdlib/malloc.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.172 2015/01/05 21:04:04 tedu Exp $ */
/* $OpenBSD: malloc.c,v 1.173 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@ -26,7 +26,7 @@
/* #define MALLOC_STATS */ /* #define MALLOC_STATS */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/param.h> /* PAGE_SHIFT ALIGN */
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/uio.h> #include <sys/uio.h>


+ 1
- 4
src/lib/libc/stdlib/random.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: random.c,v 1.28 2014/12/16 20:51:32 sthen Exp $ */
/* $OpenBSD: random.c,v 1.29 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* Copyright (c) 1983 Regents of the University of California. * Copyright (c) 1983 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -28,9 +28,6 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>


+ 3
- 3
src/lib/libc/stdlib/realpath.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: realpath.c,v 1.18 2014/10/19 03:56:28 doug Exp $ */
/* $OpenBSD: realpath.c,v 1.19 2015/01/16 16:48:51 deraadt Exp $ */
/* /*
* Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru> * Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru>
* *
@ -27,13 +27,13 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
/* A slightly modified copy of this file exists in libexec/ld.so */ /* A slightly modified copy of this file exists in libexec/ld.so */
@ -156,7 +156,7 @@ realpath(const char *path, char *resolved)
goto err; goto err;
} }
if (S_ISLNK(sb.st_mode)) { if (S_ISLNK(sb.st_mode)) {
if (symlinks++ > MAXSYMLINKS) {
if (symlinks++ > SYMLOOP_MAX) {
errno = ELOOP; errno = ELOOP;
goto err; goto err;
} }


+ 4
- 3
src/lib/libutil/readlabel.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: readlabel.c,v 1.12 2014/06/30 00:25:37 deraadt Exp $ */
/* $OpenBSD: readlabel.c,v 1.13 2015/01/16 16:48:52 deraadt Exp $ */
/* /*
* Copyright (c) 1996, Jason Downs. All rights reserved. * Copyright (c) 1996, Jason Downs. All rights reserved.
@ -25,7 +25,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/disk.h> #include <sys/disk.h>
#include <sys/dkio.h> #include <sys/dkio.h>
#define DKTYPENAMES #define DKTYPENAMES
@ -35,6 +35,7 @@
#include <stdio.h> #include <stdio.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <fcntl.h> #include <fcntl.h>
#include <paths.h> #include <paths.h>
#include <string.h> #include <string.h>
@ -49,7 +50,7 @@
char * char *
readlabelfs(char *device, int verbose) readlabelfs(char *device, int verbose)
{ {
char rpath[MAXPATHLEN];
char rpath[PATH_MAX];
struct dk_diskmap dm; struct dk_diskmap dm;
struct disklabel dk; struct disklabel dk;
char part, *type; char part, *type;


Loading…
Cancel
Save