summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv/mkalias/mkalias.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /usr.sbin/ypserv/mkalias/mkalias.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.sbin/ypserv/mkalias/mkalias.c')
-rw-r--r--usr.sbin/ypserv/mkalias/mkalias.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c
index 71e9470e2bb..e15b0388ae1 100644
--- a/usr.sbin/ypserv/mkalias/mkalias.c
+++ b/usr.sbin/ypserv/mkalias/mkalias.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkalias.c,v 1.26 2013/12/05 14:18:54 jca Exp $ */
+/* $OpenBSD: mkalias.c,v 1.27 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se>
@@ -33,7 +33,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -146,10 +145,10 @@ main(int argc, char *argv[])
datum key, val;
DBM *new_db = NULL;
static char mapname[] = "ypdbXXXXXXXXXX";
- char db_mapname[MAXPATHLEN], db_outfile[MAXPATHLEN];
- char db_tempname[MAXPATHLEN];
+ char db_mapname[PATH_MAX], db_outfile[PATH_MAX];
+ char db_tempname[PATH_MAX];
char user[4096], host[4096]; /* XXX: DB bsize = 4096 in ypdb.c */
- char myname[MAXHOSTNAMELEN], datestr[11], *slash;
+ char myname[HOST_NAME_MAX+1], datestr[11], *slash;
while ((ch = getopt(argc, argv, "Edensuv")) != -1)
switch (ch) {
@@ -196,7 +195,7 @@ main(int argc, char *argv[])
}
if (output != NULL) {
- if (strlen(output) + strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ if (strlen(output) + strlen(YPDB_SUFFIX) > PATH_MAX) {
errx(1, "%s: file name too long", output);
/* NOTREACHED */
}
@@ -213,7 +212,7 @@ main(int argc, char *argv[])
/* note: output is now directory where map goes ! */
if (strlen(output) + strlen(mapname) +
- strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ strlen(YPDB_SUFFIX) > PATH_MAX) {
errx(1, "%s: directory name too long", output);
/* NOTREACHED */
}