aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-05 23:34:36 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-06 00:19:05 +0200
commit7bd56e69dccec2794a7b568eb254a40f96b900c5 (patch)
tree0603a8f7d8da3ff28aeece5b6df45c882865517a
parent15c905f150927b16bd3d1ffe62d2bc9d92da26c5 (diff)
downloadslcl-7bd56e69dccec2794a7b568eb254a40f96b900c5.tar.gz
http.c: Accept resources with '&' or '?'
Otherwise, client requests to resources such as '/me & you', '/?' or '/??preview=1' would fail.
-rw-r--r--http.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/http.c b/http.c
index d843bb5..3862fa7 100644
--- a/http.c
+++ b/http.c
@@ -259,8 +259,10 @@ static int parse_args(struct ctx *const c, const char *const res,
size_t *const reslen)
{
int error;
- const char *const arg_start = strchr(res, '?'),
- *const ad_arg = strchr(res, '&');
+ const char *const tmp_arg_start = strrchr(res, '?'),
+ *const arg_start = tmp_arg_start && *(tmp_arg_start + 1) ?
+ tmp_arg_start : NULL,
+ *const ad_arg = arg_start ? strchr(arg_start, '&') : NULL;
if (!arg_start)
{