From a29738212841dcb699dc397ad66c3416324eccf8 Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Thu, 26 Dec 2024 17:25:35 +0100 Subject: remove check_request_path because we have unveil --- url.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'url.c') diff --git a/url.c b/url.c index 977edea..26e737f 100644 --- a/url.c +++ b/url.c @@ -42,43 +42,6 @@ #include "str.h" #include "url.h" -bool -check_request_path(const char *path, const char *suffix) -{ - char p [PATH_MAX], resolved[PATH_MAX]; - char *rp, *data_dir; - - data_dir = config_data_dir(); - if (data_dir == NULL) - return false; - - /* build absolute path from DATA_DIR */ - if (strlcpy(p, data_dir, sizeof(p)) >= sizeof(p)) - return false; - if (strlcat(p, "/", sizeof(p)) >= sizeof(p)) - return false; - if (strlcat(p, path, sizeof(p)) >= sizeof(p)) - return false; - if (strlen(suffix) > 0) { - /* add suffix */ - if (strlcat(p, ".", sizeof(p)) >= sizeof(p)) - return false; - if (strlcat(p, suffix, sizeof(p)) >= sizeof(p)) - return false; - } - /* canonicalize the path */ - rp = realpath(p, resolved); - if (rp == NULL) - return false; - - /* path must start with DATA_DIR */ - rp[PATH_MAX - 1] = '\0'; - if (strstr(rp, data_dir) != rp) - return false; - - return true; -} - char * url_encode(const char *str) { -- cgit v1.2.3