From 96b879175442b8c48a38d5b9f8bf0fddeec3a4d4 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 19 Jun 2023 17:39:53 +0200 Subject: [PATCH] Defend from kbin.social messages not having a content-type header. --- activitypub.c | 3 +++ 1 file changed, 3 insertions(+) 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);