diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-12-26 17:25:35 +0100 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-12-26 17:25:35 +0100 |
commit | a29738212841dcb699dc397ad66c3416324eccf8 (patch) | |
tree | 3a28a9730f33461a34198c0c3ff50e7c73e04051 /url.c | |
parent | 69208140ddc9faa4e607cacefab6cae9badeaa7c (diff) |
remove check_request_path because we have unveil
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 37 |
1 files changed, 0 insertions, 37 deletions
@@ -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) { |