From: Christophe Jaillet Date: Sat, 9 Nov 2019 21:36:12 +0000 (+0000) Subject: Merge r1866418 from trunk: X-Git-Tag: 2.4.42~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c174417bab9e3aa41074d4fc6eee3c59014e20d0;p=thirdparty%2Fapache%2Fhttpd.git Merge r1866418 from trunk: On Windows, fix a start-up crash if is used with a path that is not valid Submitted by: sf Reviewed/backported by: jailletc36, covener, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1869613 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 52528e778de..455b35e6f5f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.42 + *) core: On Windows, fix a start-up crash if is used with a path that is not + valid (For example, testing for a file on a flash drive that is not mounted) + [Christophe Jaillet] + *) mod_deflate, mod_brotli: honor "Accept-Encoding: foo;q=0" as per RFC 7231; which means 'foo' is "not acceptable". PR 58158 [Chistophe Jaillet] diff --git a/server/core.c b/server/core.c index 02aadd50af2..48a65ea6c5f 100644 --- a/server/core.c +++ b/server/core.c @@ -2787,8 +2787,15 @@ static int test_iffile_section(cmd_parms *cmd, const char *arg) const char *relative; apr_finfo_t sb; + /* + * At least on Windows, if the path we are testing is not valid (for example + * a path on a USB key that is not plugged), 'ap_server_root_relative()' will + * return NULL. In such a case, consider that the file is not there and that + * the section should be skipped. + */ relative = ap_server_root_relative(cmd->temp_pool, arg); - return (apr_stat(&sb, relative, 0, cmd->pool) == APR_SUCCESS); + return (relative && + (apr_stat(&sb, relative, APR_FINFO_TYPE, cmd->temp_pool) == APR_SUCCESS)); } static int test_ifdirective_section(cmd_parms *cmd, const char *arg)