diff options
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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); |