From: Nick Kew Date: Wed, 17 Jun 2009 00:31:10 +0000 (+0000) Subject: Fix bug in r785425 (dereference null pointer when not configured) X-Git-Tag: 2.3.3~509 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d0a22fad64fcfd68998880fed8a22a508ce91a3;p=thirdparty%2Fapache%2Fhttpd.git Fix bug in r785425 (dereference null pointer when not configured) and add a couple of comments. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@785457 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 002d9717c39..95071c956b1 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -125,6 +125,17 @@ static int fixup_dflt(request_rec *r) return DECLINED; } name_ptr = d->dflt; + if (name_ptr == NULL) { + return DECLINED; + } + /* XXX: if DefaultHandler points to something that doesn't exist, + * this may recurse until it hits the limit for internal redirects + * before returning an Internal Server Error. + */ + + /* The logic of this function is basically cloned and simplified + * from fixup_dir below. See the comments there. + */ if (r->args != NULL) { name_ptr = apr_pstrcat(r->pool, name_ptr, "?", r->args, NULL); } @@ -303,6 +314,7 @@ static int fixup_dir(request_rec *r) static void register_hooks(apr_pool_t *p) { + /* the order of these is of no consequence */ ap_hook_fixups(fixup_dir,NULL,NULL,APR_HOOK_LAST); ap_hook_fixups(fixup_dflt,NULL,NULL,APR_HOOK_LAST); }