Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/purple-matrix-0.0.0+git20191228/libmatrix.c Examining data/purple-matrix-0.0.0+git20191228/libmatrix.h Examining data/purple-matrix-0.0.0+git20191228/matrix-api.c Examining data/purple-matrix-0.0.0+git20191228/matrix-api.h Examining data/purple-matrix-0.0.0+git20191228/matrix-connection.c Examining data/purple-matrix-0.0.0+git20191228/matrix-connection.h Examining data/purple-matrix-0.0.0+git20191228/matrix-e2e.c Examining data/purple-matrix-0.0.0+git20191228/matrix-e2e.h Examining data/purple-matrix-0.0.0+git20191228/matrix-event.c Examining data/purple-matrix-0.0.0+git20191228/matrix-event.h Examining data/purple-matrix-0.0.0+git20191228/matrix-json.c Examining data/purple-matrix-0.0.0+git20191228/matrix-json.h Examining data/purple-matrix-0.0.0+git20191228/matrix-room.c Examining data/purple-matrix-0.0.0+git20191228/matrix-room.h Examining data/purple-matrix-0.0.0+git20191228/matrix-roommembers.c Examining data/purple-matrix-0.0.0+git20191228/matrix-roommembers.h Examining data/purple-matrix-0.0.0+git20191228/matrix-statetable.c Examining data/purple-matrix-0.0.0+git20191228/matrix-statetable.h Examining data/purple-matrix-0.0.0+git20191228/matrix-sync.c Examining data/purple-matrix-0.0.0+git20191228/matrix-sync.h FINAL RESULTS: data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1720:69: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. gboolean matrix_e2e_parse_media_decrypt_info(MatrixMediaCryptInfo **crypt, data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1780:14: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. memcpy((*crypt)->sha256, decoded_sha256, 32); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1781:14: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. memcpy((*crypt)->aes_k, decoded_k, 32); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1782:14: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. memcpy((*crypt)->aes_iv, decoded_iv, 16); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1795:60: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. const char *matrix_e2e_decrypt_media(MatrixMediaCryptInfo *crypt, data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1898:69: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. gboolean matrix_e2e_parse_media_decrypt_info(MatrixMediaCryptInfo **crypt, data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1911:60: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. const char *matrix_e2e_decrypt_media(MatrixMediaCryptInfo *crypt, data/purple-matrix-0.0.0+git20191228/matrix-e2e.h:35:69: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. gboolean matrix_e2e_parse_media_decrypt_info(MatrixMediaCryptInfo **crypt, data/purple-matrix-0.0.0+git20191228/matrix-e2e.h:37:60: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. const char *matrix_e2e_decrypt_media(MatrixMediaCryptInfo *crypt, data/purple-matrix-0.0.0+git20191228/matrix-room.c:634:27: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. MatrixMediaCryptInfo *crypt; data/purple-matrix-0.0.0+git20191228/matrix-room.c:643:58: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. const char *fail_str = matrix_e2e_decrypt_media(rid->crypt, data/purple-matrix-0.0.0+git20191228/matrix-room.c:658:17: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. g_free(rid->crypt); data/purple-matrix-0.0.0+git20191228/matrix-room.c:668:14: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. if (rid->crypt) { data/purple-matrix-0.0.0+git20191228/matrix-room.c:703:17: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. g_free(rid->crypt); data/purple-matrix-0.0.0+git20191228/matrix-room.c:720:17: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. g_free(rid->crypt); data/purple-matrix-0.0.0+git20191228/matrix-room.c:843:60: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. if (!matrix_e2e_parse_media_decrypt_info(&rid->crypt, json_file_obj)) { data/purple-matrix-0.0.0+git20191228/matrix-room.c:856:39: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. } else if (thumb_url && !rid->crypt) { data/purple-matrix-0.0.0+git20191228/matrix-room.c:868:26: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. } else if (!rid->crypt) { data/purple-matrix-0.0.0+git20191228/matrix-room.c:886:25: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. g_free(rid->crypt); data/purple-matrix-0.0.0+git20191228/matrix-room.c:944:37: [3] (random) g_random_int: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. g_get_monotonic_time(), g_random_int()); data/purple-matrix-0.0.0+git20191228/matrix-api.c:221:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(response_data->body + response_data->body_len, at, length); data/purple-matrix-0.0.0+git20191228/matrix-api.c:987:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[64]; data/purple-matrix-0.0.0+git20191228/matrix-api.c:997:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tmp, "?width=%u", width); data/purple-matrix-0.0.0+git20191228/matrix-api.c:999:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tmp, "&height=%u", height); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:111:21: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *urandom = fopen("/dev/urandom", "rb"); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1780:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((*crypt)->sha256, decoded_sha256, 32); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1781:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((*crypt)->aes_k, decoded_k, 32); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1782:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((*crypt)->aes_iv, decoded_iv, 16); data/purple-matrix-0.0.0+git20191228/matrix-room.c:1446:27: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int imgstore_id = atoi(g_datalist_get_data(&image_attribs, "id")); data/purple-matrix-0.0.0+git20191228/matrix-api.c:361:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). t2 = purple_base64_encode((const guchar *)t1, strlen(t1)); data/purple-matrix-0.0.0+git20191228/matrix-api.c:453:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). extra_len + (body == NULL ? 0 : strlen(body))); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:149:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). clear_mem(ok->sender_key, strlen(ok->sender_key)); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:309:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(body)); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:374:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(dupe_pickle)) == olm_error()) { data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:394:64: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). body_double, strlen(body)); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:602:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (olm_account_sign(account, can_json_c, strlen(can_json_c), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:699:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). account_string, strlen(account_string), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:738:70: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (olm_unpickle_account(conn->e2e->oa, "!", 1, pickled_account, strlen(retrieved_pickle)) == data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:777:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). id_keys, strlen(id_keys), &err)) { data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:866:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). olm_1t_keys_json, strlen(olm_1t_keys_json), &err)) { data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1294:40: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(mrk_session_key)) == data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1331:61: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!json_parser_load_from_data(json_parser, plaintext, strlen(plaintext), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1465:60: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sender_key, strlen(sender_key), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1467:48: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(cevent_body)) == data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1499:40: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(cevent_body_copy)); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1510:40: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(cevent_body), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1655:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(dupe_ciphertext)); data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1669:44: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(dupe_ciphertext), data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1696:48: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). plaintext, strlen(plaintext), &err)) { data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1749:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(iv_str) != 22 || strlen(sha256_str) != 43 || data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1749:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(iv_str) != 22 || strlen(sha256_str) != 43 || data/purple-matrix-0.0.0+git20191228/matrix-e2e.c:1750:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(k_str) != 43) { ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 7755 in approximately 0.19 seconds (40815 lines/second) Physical Source Lines of Code (SLOC) = 4929 Hits@level = [0] 3 [1] 23 [2] 9 [3] 1 [4] 19 [5] 0 Hits@level+ = [0+] 55 [1+] 52 [2+] 29 [3+] 20 [4+] 19 [5+] 0 Hits/KSLOC@level+ = [0+] 11.1584 [1+] 10.5498 [2+] 5.88355 [3+] 4.05762 [4+] 3.85474 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.