commit 4f1687a
grunfink
·
2026-05-22 15:00:51 +0000 UTC
parent ed8d68f
Ensure the request path have enough parts.
1 files changed,
+7,
-0
+7,
-0
1@@ -3884,6 +3884,10 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
2 return 0;
3
4 xs *l = xs_split_n(q_path, "/", 2);
5+
6+ if (xs_list_len(l) <= 1)
7+ return HTTP_STATUS_BAD_REQUEST;
8+
9 const char *uid;
10 const char *p_path;
11
12@@ -4071,6 +4075,9 @@ int activitypub_post_handler(const xs_dict *req, const char *q_path,
13 /* get the user and path */
14 xs *l = xs_split_n(q_path, "/", 2);
15
16+ if (xs_list_len(l) <= 1)
17+ return HTTP_STATUS_BAD_REQUEST;
18+
19 if (xs_list_len(l) == 2 && strcmp(xs_list_get(l, 1), "shared-inbox") == 0) {
20 enqueue_shared_input(msg, req, 0);
21 return HTTP_STATUS_ACCEPTED;