summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd/server.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/httpd/server.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/httpd/server.c')
-rw-r--r--usr.sbin/httpd/server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index f4b6414c9fd..943e60af036 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.51 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.52 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -16,6 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@@ -45,6 +46,8 @@
#include "httpd.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
int server_dispatch_parent(int, struct privsep_proc *,
struct imsg *);
int server_dispatch_logger(int, struct privsep_proc *,
@@ -569,7 +572,7 @@ server_tls_readcb(int fd, short event, void *arg)
}
if (bufev->wm_read.high != 0)
- howmuch = MIN(sizeof(rbuf), bufev->wm_read.high);
+ howmuch = MINIMUM(sizeof(rbuf), bufev->wm_read.high);
ret = tls_read(clt->clt_tls_ctx, rbuf, howmuch, &len);
if (ret == TLS_READ_AGAIN || ret == TLS_WRITE_AGAIN) {
@@ -1025,7 +1028,7 @@ server_sendlog(struct server_config *srv_conf, int cmd, const char *emsg, ...)
void
server_log(struct client *clt, const char *msg)
{
- char ibuf[MAXHOSTNAMELEN], obuf[MAXHOSTNAMELEN];
+ char ibuf[HOST_NAME_MAX+1], obuf[HOST_NAME_MAX+1];
struct server_config *srv_conf = clt->clt_srv_conf;
char *ptr = NULL;
int debug_cmd = -1;