summaryrefslogtreecommitdiff
path: root/url.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2024-01-23 09:22:00 +0100
committerVincent Douillet <vincent@vdouillet.fr>2024-02-08 09:27:54 +0100
commit42f538cc66546997a166dbe67e489c9afabbb908 (patch)
tree718bb6b7161892c4b964499c1818c6d7bf0bd6a6 /url.c
parent760031b4a74d70bdeaab4ce9aedfe772acd05bd3 (diff)
download files
Diffstat (limited to 'url.c')
-rw-r--r--url.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/url.c b/url.c
index 72c02a0..228efeb 100644
--- a/url.c
+++ b/url.c
@@ -38,9 +38,9 @@
#include "url.h"
bool
-check_request_path(char *path)
+check_request_path(char *path, char *suffix)
{
- char p [PATH_MAX], resolved[PATH_MAX];
+ char p[PATH_MAX], resolved[PATH_MAX];
char *rp;
/* build absolute path from DATA_DIR */
@@ -50,6 +50,13 @@ check_request_path(char *path)
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);