]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Follow up to r1879075: ap_getparents() to return the empty string above root.
authorYann Ylavic <ylavic@apache.org>
Wed, 24 Jun 2020 09:21:32 +0000 (09:21 +0000)
committerYann Ylavic <ylavic@apache.org>
Wed, 24 Jun 2020 09:21:32 +0000 (09:21 +0000)
Actually it was its previous behaviour before it was implemented using
ap_normalize_path() in r1879075.

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

server/util.c

index b92e27eb6f85961b5b24cdc154077c9264908082..24480019c148df15e03f5f82ed1bc87c618fd3af 100644 (file)
@@ -607,7 +607,10 @@ AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags)
  */
 AP_DECLARE(void) ap_getparents(char *name)
 {
-    (void)ap_normalize_path(name, AP_NORMALIZE_ALLOW_RELATIVE);
+    if (!ap_normalize_path(name, AP_NORMALIZE_NOT_ABOVE_ROOT |
+                                 AP_NORMALIZE_ALLOW_RELATIVE)) {
+        name[0] = '\0';
+    }
 }
 
 AP_DECLARE(void) ap_no2slash_ex(char *name, int is_fs_path)