]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix an issue on Windows where <IfFile> looks for a file on a non-existent drive ...
authorChristophe Jaillet <jailletc36@apache.org>
Wed, 4 Sep 2019 19:11:28 +0000 (19:11 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Wed, 4 Sep 2019 19:11:28 +0000 (19:11 +0000)
Issue repported by Heather Lotz <knot22 hotmail.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1866418 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/core.c

diff --git a/CHANGES b/CHANGES
index cba4b195abdba36cc10ea1f6961479e4fac323be..d152919575d9d47ef5968bcb2c82a615c60b3f58 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) core: On Windows, fix a start-up crash if <IfFile ...> 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_proxy_balancer: Fix case-sensitive referer check related to CSRF/XSS 
      protection. PR63688. [Armin Abfalterer <a.abfalterer gmail.com>]
 
index 11bf8d3d102ab27de2d3fc34385bb20b102020a6..6de5892a21d3a9e52d22d6c67bb9a71aaccb6e21 100644 (file)
@@ -2948,8 +2948,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)