diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2021-08-07 17:32:41 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2021-08-07 17:32:41 +0300 |
commit | 29c860170ca18c3f7f15b5ba7723e06ddc760361 (patch) | |
tree | 6030310491dccb090c6b4a1d1b8576426ec45d3e /skypeweb/skypeweb_messages.c | |
parent | 64643141faca03475c01244aefe7d98771144933 (diff) |
sa->pc safety check in request/timeout callbacks
It mitigates a common cause of segmentation faults due to a freed
SkypeAccount structure which may contain corrupted data already,
still the sa->pc may be NULL as it is freed right before the whole
structure. It does not guarantee the crash prevention though, and does
not solve the root problem, as these callbacks should be removed and
not invoked if an account is disconnected.
The crash backtraces are collected in #650, most of them happened in
`skypeweb_post_or_get`.
Diffstat (limited to 'skypeweb/skypeweb_messages.c')
-rw-r--r-- | skypeweb/skypeweb_messages.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/skypeweb/skypeweb_messages.c b/skypeweb/skypeweb_messages.c index 959fb31..4acca45 100644 --- a/skypeweb/skypeweb_messages.c +++ b/skypeweb/skypeweb_messages.c @@ -1215,6 +1215,8 @@ skypeweb_got_registration_token(PurpleHttpConnection *http_conn, PurpleHttpRespo gchar *new_messages_host = NULL; const gchar *data; gsize len; + + g_return_if_fail(sa->pc); data = purple_http_response_get_data(response, &len); @@ -1282,6 +1284,8 @@ skypeweb_got_vdms_token(PurpleHttpConnection *http_conn, PurpleHttpResponse *res { const gchar *token; SkypeWebAccount *sa = user_data; + g_return_if_fail(sa->pc); + JsonParser *parser = json_parser_new(); const gchar *data; gsize len; |