aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt2015-01-16 06:39:28 +0000
committerWynn Wolf Arbor2020-05-24 12:33:55 +0200
commit1db88be4600befacab6adc2579291f8c0c000727 (patch)
treea2dc21e68e60bca0b9815872a891d5b15dec2c81
parent1ec3ce18c83f70c24216677ab365ad746bc15400 (diff)
downloadslowcgi-1db88be4600befacab6adc2579291f8c0c000727.tar.gz
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)
-rw-r--r--slowcgi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/slowcgi.c b/slowcgi.c
index fdf0cd9..44595bb 100644
--- a/slowcgi.c
+++ b/slowcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slowcgi.c,v 1.41 2014/12/08 12:12:46 blambert Exp $ */
+/* $OpenBSD: slowcgi.c,v 1.42 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
* Copyright (c) 2013 Florian Obser <florian@openbsd.org>
@@ -30,6 +30,7 @@
#include <errno.h>
#include <event.h>
#include <netdb.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -118,7 +119,7 @@ struct request {
struct fcgi_response_head response_head;
struct fcgi_stdin_head stdin_head;
uint16_t id;
- char script_name[MAXPATHLEN];
+ char script_name[PATH_MAX];
struct env_head env;
int env_count;
pid_t script_pid;
@@ -745,11 +746,11 @@ parse_params(uint8_t *buf, uint16_t n, struct request *c, uint16_t id)
n -= name_len;
env_entry->val[name_len] = '\0';
- if (val_len < MAXPATHLEN && strcmp(env_entry->val,
+ if (val_len < PATH_MAX && strcmp(env_entry->val,
"SCRIPT_NAME") == 0 && c->script_name[0] == '\0') {
bcopy(buf, c->script_name, val_len);
c->script_name[val_len] = '\0';
- } else if (val_len < MAXPATHLEN && strcmp(env_entry->val,
+ } else if (val_len < PATH_MAX && strcmp(env_entry->val,
"SCRIPT_FILENAME") == 0) {
bcopy(buf, c->script_name, val_len);
c->script_name[val_len] = '\0';