1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Fix segfault when aesgcm url isn't the expected size

Fixes the bug mentioned in
https://github.com/profanity-im/profanity/issues/1478#issuecomment-794161606

The rest of https://github.com/profanity-im/profanity/issues/1478 I
can't reproduce. Seems to work fine.
This commit is contained in:
Michael Vetter 2021-06-30 12:27:11 +02:00
parent f30a9e1256
commit a46c4443e3
2 changed files with 2 additions and 0 deletions

View File

@ -1862,6 +1862,7 @@ omemo_parse_aesgcm_url(const char* aesgcm_url,
}
if (strlen(*fragment) != AESGCM_URL_NONCE_LEN + AESGCM_URL_KEY_LEN) {
ret = 1;
goto out;
}

View File

@ -70,6 +70,7 @@ aesgcm_file_get(void* userdata)
// Convert the aesgcm:// URL to a https:// URL and extract the encoded key
// and tag stored in the URL fragment.
if (omemo_parse_aesgcm_url(aesgcm_dl->url, &https_url, &fragment) != 0) {
cons_show_error("Download failed: Cannot parse URL '%s'.", aesgcm_dl->url);
http_print_transfer_update(aesgcm_dl->window, aesgcm_dl->url,
"Download failed: Cannot parse URL '%s'.",
aesgcm_dl->url);