diff options
| author | la_ninpre <aaoth@aaoth.xyz> | 2026-01-28 11:30:03 +0300 |
|---|---|---|
| committer | la_ninpre <aaoth@aaoth.xyz> | 2026-01-28 11:39:44 +0300 |
| commit | 2f0f3d45f4335327c269a689fbeb62b3003695aa (patch) | |
| tree | 4a6f455e33572e1f58beefc4a03efcaccf89408e /data.c | |
| parent | f7073bfe61c6e011ec861edd07c791c884b6ff45 (diff) | |
static files: allow files in a subdirectory
allowing '/' in paths is a bit scary, but
replacing the check with reject on '..' seems to work.
please correct me if i'm wrong and this is insecure.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2691,7 +2691,7 @@ static int _load_raw_file(const char *fn, xs_val **data, int *size, xs_str *_static_fn(snac *snac, const char *id) /* gets the filename for a static file */ { - if (strchr(id, '/')) + if (strstr(id, "..")) return NULL; else return xs_fmt("%s/static/%s", snac->basedir, id); |