From: Yann Ylavic Date: Wed, 24 Jun 2020 09:21:32 +0000 (+0000) Subject: Follow up to r1879075: ap_getparents() to return the empty string above root. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1338 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85ab7bcd3355fdab60acfa85bfb894b7fbcad09e;p=thirdparty%2Fapache%2Fhttpd.git 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 --- 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)