commit 96b879175442b8c48a38d5b9f8bf0fddeec3a4d4
parent 42803e21169018b4b1d5fcd7ae0617b8f3f65053
Author: default <nobody@localhost>
Date: Mon, 19 Jun 2023 17:39:53 +0200
Defend from kbin.social messages not having a content-type header.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git 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);