From 9c5bffa94b9e0af13845cb7466c95a079f54a630 Mon Sep 17 00:00:00 2001 From: Dave Gilbert Date: Mon, 4 Jul 2022 16:31:04 +0100 Subject: matrix-api: Check for missing content type (#124) Fix segfault when processing replies with no `content-type`. --- matrix-api.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/matrix-api.c b/matrix-api.c index 0884c93..9edea18 100644 --- a/matrix-api.c +++ b/matrix-api.c @@ -238,6 +238,11 @@ static int _handle_message_complete(http_parser *http_parser) MatrixApiResponseParserData *response_data = http_parser->data; GError *err = NULL; + if (!response_data->content_type) { + purple_debug_info("matrixprpl", "Missing content type\n"); + return 1; + } + if(strcmp(response_data->content_type, "application/json") == 0) { if(!json_parser_load_from_data(response_data -> json_parser, response_data->body, -- cgit