From 85ab7bcd3355fdab60acfa85bfb894b7fbcad09e Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Wed, 24 Jun 2020 09:21:32 +0000 Subject: [PATCH] Follow up to r1879075: ap_getparents() to return the empty string above root. 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/util.c b/server/util.c index b92e27eb6f8..24480019c14 100644 --- a/server/util.c +++ b/server/util.c @@ -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) -- 2.47.3