From 72265f6242360a388f382c5606d41531685dc1c0 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 29 Jan 2002 04:54:05 +0000 Subject: [PATCH] Don't let the default handler try to serve a raw directory. At best you get gibberish. Much worse things can happen depending on the OS. This can happen when autoindex isn't loaded. On AIX, I had a directory file which was reported to be 1536 bytes in size. mmap() failed so we went to the fall-back logic. The first read() got 624 bytes and the next read() got 0 (supposedly EOF). This confused us greatly, we kept allocating buffers and reading and exercised the paging space. Reviewed by: Bill Rowe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93071 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ server/core.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 10e04c1569..5894466dc4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.31-dev + *) Don't let the default handler try to serve a raw directory. At + best you get gibberish. Much worse things can happen depending + on the OS. [Jeff Trawick] + *) Change the pre_config hook to return a value. Modules can now emit an error message and then cause the server to quit gracefully during startup. This required a bump to the MMN. [Aaron Bannert] diff --git a/server/core.c b/server/core.c index cdcea13ec0..1cdfbfe4c4 100644 --- a/server/core.c +++ b/server/core.c @@ -2899,9 +2899,12 @@ static int default_handler(request_rec *r) * match literally anything - this way will require handler to * have a / in the middle, which probably captures the original * intent, but may cause problems at first - Ben 7th Jan 01 + * Don't try to serve a dir. Some OSs do weird things with + * raw I/O on a dir. */ - if (strcmp(r->handler, "default-handler") - && !ap_strchr_c(r->handler, '/')) + if ((strcmp(r->handler, "default-handler") + && !ap_strchr_c(r->handler, '/')) + || r->finfo.filetype == APR_DIR) return DECLINED; d = (core_dir_config *)ap_get_module_config(r->per_dir_config, -- 2.40.0