forked from mirrors/nixpkgs
89 lines
7.7 KiB
Diff
89 lines
7.7 KiB
Diff
diff --git a/libexec/httpd/auth-bozo.c b/libexec/httpd/auth-bozo.c
|
|
index a2f2ee4304c1..c9eefe3313dd 100644
|
|
--- a/libexec/httpd/auth-bozo.c
|
|
+++ b/libexec/httpd/auth-bozo.c
|
|
@@ -54,7 +54,7 @@ bozo_auth_check(bozo_httpreq_t *request, const char *file)
|
|
bozohttpd_t *httpd = request->hr_httpd;
|
|
struct stat sb;
|
|
char dir[MAXPATHLEN], authfile[MAXPATHLEN], *basename;
|
|
- char user[BUFSIZ], *pass;
|
|
+ char user[BOZO_MINBUFSIZE], *pass;
|
|
FILE *fp;
|
|
int len;
|
|
|
|
@@ -144,7 +144,7 @@ bozo_auth_check_headers(bozo_httpreq_t *request, char *val, char *str,
|
|
|
|
if (strcasecmp(val, "authorization") == 0 &&
|
|
strncasecmp(str, "Basic ", 6) == 0) {
|
|
- char authbuf[BUFSIZ];
|
|
+ char authbuf[BOZO_MINBUFSIZE];
|
|
char *pass = NULL;
|
|
ssize_t alen;
|
|
|
|
diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c
|
|
index 273cb5f5a42b..f619567ba822 100644
|
|
--- a/libexec/httpd/bozohttpd.c
|
|
+++ b/libexec/httpd/bozohttpd.c
|
|
@@ -2275,7 +2275,7 @@ bozo_http_error(bozohttpd_t *httpd, int code, bozo_httpreq_t *request,
|
|
}
|
|
#endif /* !NO_USER_SUPPORT */
|
|
|
|
- size = snprintf(httpd->errorbuf, BUFSIZ,
|
|
+ size = snprintf(httpd->errorbuf, BOZO_MINBUFSIZE,
|
|
"<html><head><title>%s</title></head>\n"
|
|
"<body><h1>%s</h1>\n"
|
|
"%s%s: <pre>%s</pre>\n"
|
|
@@ -2285,10 +2285,10 @@ bozo_http_error(bozohttpd_t *httpd, int code, bozo_httpreq_t *request,
|
|
user ? user : "", file,
|
|
reason, hostname, portbuf, hostname, portbuf);
|
|
free(user);
|
|
- if (size >= (int)BUFSIZ) {
|
|
+ if (size >= (int)BOZO_MINBUFSIZE) {
|
|
bozowarn(httpd,
|
|
"bozo_http_error buffer too small, truncated");
|
|
- size = (int)BUFSIZ;
|
|
+ size = (int)BOZO_MINBUFSIZE;
|
|
}
|
|
|
|
if (file_alloc)
|
|
@@ -2515,7 +2515,7 @@ bozo_init_httpd(bozohttpd_t *httpd)
|
|
httpd->mmapsz = BOZO_MMAPSZ;
|
|
|
|
/* error buffer for bozo_http_error() */
|
|
- if ((httpd->errorbuf = malloc(BUFSIZ)) == NULL) {
|
|
+ if ((httpd->errorbuf = malloc(BOZO_MINBUFSIZE)) == NULL) {
|
|
fprintf(stderr,
|
|
"bozohttpd: memory_allocation failure\n");
|
|
return 0;
|
|
diff --git a/libexec/httpd/bozohttpd.h b/libexec/httpd/bozohttpd.h
|
|
index c83bd112d9d7..7b19494cf5ad 100644
|
|
--- a/libexec/httpd/bozohttpd.h
|
|
+++ b/libexec/httpd/bozohttpd.h
|
|
@@ -227,6 +227,8 @@ typedef struct bozoprefs_t {
|
|
/* only allow this many total headers bytes */
|
|
#define BOZO_HEADERS_MAX_SIZE (16 * 1024)
|
|
|
|
+#define BOZO_MINBUFSIZE (4 * 1024)
|
|
+
|
|
/* debug flags */
|
|
#define DEBUG_NORMAL 1
|
|
#define DEBUG_FAT 2
|
|
diff --git a/libexec/httpd/testsuite/t10.out b/libexec/httpd/testsuite/t10.out
|
|
index cf410110627c..b3ab88f94fb9 100644
|
|
--- a/libexec/httpd/testsuite/t10.out
|
|
+++ b/libexec/httpd/testsuite/t10.out
|
|
@@ -1,8 +1,8 @@
|
|
HTTP/1.0 404 Not Found
|
|
Content-Type: text/html
|
|
-Content-Length: 1024
|
|
-Server: bozohttpd/20140708
|
|
+Content-Length: 4096
|
|
+Server: bozohttpd/20210403
|
|
|
|
<html><head><title>404 Not Found</title></head>
|
|
<body><h1>404 Not Found</h1>
|
|
-/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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