summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-06-19 17:39:53 +0200
committerdefault <nobody@localhost>2023-06-19 17:39:53 +0200
commit96b879175442b8c48a38d5b9f8bf0fddeec3a4d4 (patch)
tree4c406526e11c22088433a80cd2872401ab590fde /activitypub.c
parent42803e21169018b4b1d5fcd7ae0617b8f3f65053 (diff)
Defend from kbin.social messages not having a content-type header.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c
index e6af8bf..5523b65 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -90,6 +90,9 @@ int activitypub_request(snac *snac, const char *url, xs_dict **data)
/* ensure it's ActivityPub data */
ctype = xs_dict_get(response, "content-type");
+ if (xs_is_null(ctype))
+ status = 400;
+ else
if (xs_str_in(ctype, "application/activity+json") != -1 ||
xs_str_in(ctype, "application/ld+json") != -1)
*data = xs_json_loads(payload);