aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Gilbert <dave@treblig.org>2022-07-04 16:31:04 +0100
committerGitHub <noreply@github.com>2022-07-04 16:31:04 +0100
commit9c5bffa94b9e0af13845cb7466c95a079f54a630 (patch)
tree9b58e560f6db1fe373e432bcb2ea2d2a6b2e218a
parenta6522bb3986c332f7c3cbe3c4aa8e6945d6307ac (diff)
downloadpurple-matrix-9c5bffa94b9e0af13845cb7466c95a079f54a630.tar.gz
matrix-api: Check for missing content type (#124)
Fix segfault when processing replies with no `content-type`.
-rw-r--r--matrix-api.c5
1 files changed, 5 insertions, 0 deletions
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,