From 5b40abcf96ed80dac42133e712cb01524efa88c4 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 16 Jan 2015 16:18:07 +0000 Subject: [PATCH] to conversion. Verified binaries ok millert, thanks to doug for process advice --- libexec/ld.so/boot.c | 3 +-- libexec/ld.so/dir.c | 5 ++--- libexec/ld.so/dl_dirname.c | 8 ++++---- libexec/ld.so/dl_prebind.c | 3 +-- libexec/ld.so/dl_uname.c | 4 ++-- libexec/ld.so/ldconfig/debug.c | 3 +-- libexec/ld.so/ldconfig/dl_prebind.c | 3 +-- libexec/ld.so/ldconfig/ldconfig.c | 6 +++--- libexec/ld.so/ldconfig/library.c | 10 +++++----- libexec/ld.so/ldconfig/prebind.c | 3 +-- libexec/ld.so/ldconfig/shlib.c | 3 +-- libexec/ld.so/ldd/ldd.c | 6 +++--- libexec/ld.so/library.c | 3 +-- libexec/ld.so/library_mquery.c | 3 +-- libexec/ld.so/library_subr.c | 9 ++++----- libexec/ld.so/loader.c | 3 +-- libexec/ld.so/malloc.c | 6 ++---- libexec/ld.so/path.c | 3 +-- libexec/ld.so/strtol.c | 5 +++-- libexec/ld.so/trace.c | 3 +-- libexec/ld.so/util.c | 3 +-- 21 files changed, 40 insertions(+), 55 deletions(-) diff --git a/libexec/ld.so/boot.c b/libexec/ld.so/boot.c index a28b660174e..ca51e80be22 100644 --- a/libexec/ld.so/boot.c +++ b/libexec/ld.so/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.4 2014/11/15 02:14:10 guenther Exp $ */ +/* $OpenBSD: boot.c,v 1.5 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c index 43b9953c699..4b4507d5ac9 100644 --- a/libexec/ld.so/dir.c +++ b/libexec/ld.so/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.22 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: dir.c,v 1.23 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,8 +28,7 @@ * SUCH DAMAGE. */ -#include -#include +#include #include #include diff --git a/libexec/ld.so/dl_dirname.c b/libexec/ld.so/dl_dirname.c index 6079ce9c1a2..ed9128e4979 100644 --- a/libexec/ld.so/dl_dirname.c +++ b/libexec/ld.so/dl_dirname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_dirname.c,v 1.1 2013/04/05 12:58:03 kurt Exp $ */ +/* $OpenBSD: dl_dirname.c,v 1.2 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1997, 2004 Todd C. Miller @@ -16,8 +16,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include - +#include +#include #include "archdep.h" /* @@ -28,7 +28,7 @@ char * _dl_dirname(const char *path) { - static char dname[MAXPATHLEN]; + static char dname[PATH_MAX]; size_t len; const char *endp; diff --git a/libexec/ld.so/dl_prebind.c b/libexec/ld.so/dl_prebind.c index f344dfa8bae..6d38b52a549 100644 --- a/libexec/ld.so/dl_prebind.c +++ b/libexec/ld.so/dl_prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_prebind.c,v 1.16 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: dl_prebind.c,v 1.17 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn * @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/libexec/ld.so/dl_uname.c b/libexec/ld.so/dl_uname.c index 1d35e2ad6b6..d085f7356a4 100644 --- a/libexec/ld.so/dl_uname.c +++ b/libexec/ld.so/dl_uname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_uname.c,v 1.1 2013/04/05 12:58:03 kurt Exp $ */ +/* $OpenBSD: dl_uname.c,v 1.2 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. @@ -28,7 +28,7 @@ * SUCH DAMAGE. */ -#include +#include #include #include diff --git a/libexec/ld.so/ldconfig/debug.c b/libexec/ld.so/ldconfig/debug.c index 31d466ee3bc..550dac032e3 100644 --- a/libexec/ld.so/ldconfig/debug.c +++ b/libexec/ld.so/ldconfig/debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.c,v 1.5 2013/12/03 01:47:06 deraadt Exp $ */ +/* $OpenBSD: debug.c,v 1.6 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn * @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/libexec/ld.so/ldconfig/dl_prebind.c b/libexec/ld.so/ldconfig/dl_prebind.c index 9e50a68db97..151b44062dd 100644 --- a/libexec/ld.so/ldconfig/dl_prebind.c +++ b/libexec/ld.so/ldconfig/dl_prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_prebind.c,v 1.2 2008/04/09 21:45:26 kurt Exp $ */ +/* $OpenBSD: dl_prebind.c,v 1.3 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/libexec/ld.so/ldconfig/ldconfig.c b/libexec/ld.so/ldconfig/ldconfig.c index ff9906f1ba0..34ea75b8865 100644 --- a/libexec/ld.so/ldconfig/ldconfig.c +++ b/libexec/ld.so/ldconfig/ldconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldconfig.c,v 1.32 2013/12/30 21:58:07 deraadt Exp $ */ +/* $OpenBSD: ldconfig.c,v 1.33 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1993,1995 Paul Kranenburg @@ -30,7 +30,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include #include "prebind.h" @@ -202,7 +202,7 @@ dodir(char *dir, int silent) { DIR *dd; struct dirent *dp; - char name[MAXPATHLEN]; + char name[PATH_MAX]; int dewey[MAXDEWEY], ndewey; if ((dd = opendir(dir)) == NULL) { diff --git a/libexec/ld.so/ldconfig/library.c b/libexec/ld.so/ldconfig/library.c index e8e71fa31dc..4b1ff1059e7 100644 --- a/libexec/ld.so/ldconfig/library.c +++ b/libexec/ld.so/ldconfig/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.6 2013/12/03 01:47:06 deraadt Exp $ */ +/* $OpenBSD: library.c,v 1.7 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn * @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include #include #include "link.h" #include "sod.h" @@ -151,7 +151,7 @@ elf_load_shlib_hint(struct sod *sod, struct sod *req_sod, return object; } -char elf_hint_store[MAXPATHLEN]; +char elf_hint_store[PATH_MAX]; char * elf_find_shlib(struct sod *sodp, char **searchpath, int nohints) @@ -223,7 +223,7 @@ nohints: match = 1; len = strlcpy( elf_hint_store, *pp, - MAXPATHLEN); + PATH_MAX); if (pp[0][len-1] != '/') { elf_hint_store[len] = '/'; @@ -232,7 +232,7 @@ nohints: strlcpy( &elf_hint_store[len], dp->d_name, - MAXPATHLEN-len); + PATH_MAX-len); if (tsod.sod_major == -1) break; } diff --git a/libexec/ld.so/ldconfig/prebind.c b/libexec/ld.so/ldconfig/prebind.c index 08a2d1ea75e..cb7e4535d49 100644 --- a/libexec/ld.so/ldconfig/prebind.c +++ b/libexec/ld.so/ldconfig/prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prebind.c,v 1.27 2014/10/18 03:19:04 doug Exp $ */ +/* $OpenBSD: prebind.c,v 1.28 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn * @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/libexec/ld.so/ldconfig/shlib.c b/libexec/ld.so/ldconfig/shlib.c index def2ac0a7dc..17ba7c4669e 100644 --- a/libexec/ld.so/ldconfig/shlib.c +++ b/libexec/ld.so/ldconfig/shlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shlib.c,v 1.9 2006/05/13 16:33:40 deraadt Exp $ */ +/* $OpenBSD: shlib.c,v 1.10 2015/01/16 16:18:07 deraadt Exp $ */ /* $NetBSD: shlib.c,v 1.13 1998/04/04 01:00:29 fvdl Exp $ */ /* @@ -32,7 +32,6 @@ * */ -#include #include #include #include diff --git a/libexec/ld.so/ldd/ldd.c b/libexec/ld.so/ldd/ldd.c index f68237160b5..127961be189 100644 --- a/libexec/ld.so/ldd/ldd.c +++ b/libexec/ld.so/ldd/ldd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldd.c,v 1.17 2014/10/18 03:16:19 doug Exp $ */ +/* $OpenBSD: ldd.c,v 1.18 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2001 Artur Grabowski * All rights reserved. @@ -31,12 +31,12 @@ #include #include #include +#include #include #include #include #include -#include int usage(void); int doit(char *); @@ -95,7 +95,7 @@ doit(char *name) Elf_Ehdr ehdr; Elf_Phdr *phdr; int fd, i, size, status, interp=0; - char buf[MAXPATHLEN]; + char buf[PATH_MAX]; void * dlhandle; if ((fd = open(name, O_RDONLY)) < 0) { diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index b8f0f6ea6ae..255838ac996 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.70 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: library.c,v 1.71 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -30,7 +30,6 @@ #define _DYN_LOADER #include -#include #include #include #include "dl_prebind.h" diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index c6fc00616a0..b331958c14f 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.47 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.48 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -30,7 +30,6 @@ #define _DYN_LOADER #include -#include #include #include #include "dl_prebind.h" diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c index 13d27d6ba81..3d2a3dcd403 100644 --- a/libexec/ld.so/library_subr.c +++ b/libexec/ld.so/library_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_subr.c,v 1.41 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: library_subr.c,v 1.42 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -30,7 +30,6 @@ #define _DYN_LOADER #include -#include #include #include #include @@ -121,7 +120,7 @@ _dl_cmp_sod(struct sod *sodp, const struct sod *lsod) return match; } -char _dl_hint_store[MAXPATHLEN]; +char _dl_hint_store[PATH_MAX]; char * _dl_find_shlib(struct sod *sodp, char **searchpath, int nohints) @@ -194,7 +193,7 @@ nohints: match = 1; len = _dl_strlcpy( _dl_hint_store, *pp, - MAXPATHLEN); + PATH_MAX); if (pp[0][len-1] != '/') { _dl_hint_store[len] = '/'; @@ -203,7 +202,7 @@ nohints: _dl_strlcpy( &_dl_hint_store[len], dp->d_name, - MAXPATHLEN-len); + PATH_MAX-len); if (tsod.sod_major == -1) break; } diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 8cc91d2f842..d09c2bb8386 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.151 2014/11/03 17:50:56 guenther Exp $ */ +/* $OpenBSD: loader.c,v 1.152 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/libexec/ld.so/malloc.c b/libexec/ld.so/malloc.c index df23ccc0e56..4e8626412d0 100644 --- a/libexec/ld.so/malloc.c +++ b/libexec/ld.so/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.5 2014/11/03 06:08:56 guenther Exp $ */ +/* $OpenBSD: malloc.c,v 1.6 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -23,9 +23,7 @@ * can buy me a beer in return. Poul-Henning Kamp */ - -#include -#include +#include /* PAGE_SHIFT ALIGN */ #include #include #include diff --git a/libexec/ld.so/path.c b/libexec/ld.so/path.c index 48fe67c95db..37f9fcc4f47 100644 --- a/libexec/ld.so/path.c +++ b/libexec/ld.so/path.c @@ -1,4 +1,4 @@ -/* $OpenBSD: path.c,v 1.3 2014/07/10 09:03:01 otto Exp $ */ +/* $OpenBSD: path.c,v 1.4 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2013 Kurt Miller @@ -17,7 +17,6 @@ */ #include -#include #include "path.h" #include "util.h" diff --git a/libexec/ld.so/strtol.c b/libexec/ld.so/strtol.c index fbaf805b516..7116e557cb3 100644 --- a/libexec/ld.so/strtol.c +++ b/libexec/ld.so/strtol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtol.c,v 1.1 2003/07/06 20:03:58 deraadt Exp $ */ +/* $OpenBSD: strtol.c,v 1.2 2015/01/16 16:18:07 deraadt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -29,7 +29,8 @@ * SUCH DAMAGE. */ -#include +#include +#include #include "util.h" /* diff --git a/libexec/ld.so/trace.c b/libexec/ld.so/trace.c index 60d90b974ca..0d6b211b2d0 100644 --- a/libexec/ld.so/trace.c +++ b/libexec/ld.so/trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trace.c,v 1.2 2014/07/06 17:33:10 otto Exp $ */ +/* $OpenBSD: trace.c,v 1.3 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -17,7 +17,6 @@ */ #include -#include #include "syscall.h" #include "resolve.h" diff --git a/libexec/ld.so/util.c b/libexec/ld.so/util.c index d70b1a4b304..054a0938dd3 100644 --- a/libexec/ld.so/util.c +++ b/libexec/ld.so/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.36 2014/12/09 15:36:36 tedu Exp $ */ +/* $OpenBSD: util.c,v 1.37 2015/01/16 16:18:07 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -27,7 +27,6 @@ */ #include -#include #include "archdep.h" /* -- 2.20.1