From 3e618c2d0f1d489e13ed1f45b5a9068936c05743 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 23 Jan 2025 23:24:22 +0100 Subject: main.c: Require paths with leading '/' on sharing When sharing, paths must be expressed as an absolute path e.g.: /path/to/file . --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index aa57c5e..e0e881e 100644 --- a/main.c +++ b/main.c @@ -821,7 +821,7 @@ static int share(const struct http_payload *const p, const char *const path = forms->value, *const username = p->cookie.field; struct stat sb; - if (path_invalid(path)) + if (path_invalid(path) || *path != '/') { fprintf(stderr, "%s: invalid path %s\n", __func__, path); ret = page_bad_request(r); -- cgit v1.2.3