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/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c Examining data/libomemo-0.6.2+git20200527.e3b212/src/libomemo_crypto.c Examining data/libomemo-0.6.2+git20200527.e3b212/src/libomemo_crypto.h Examining data/libomemo-0.6.2+git20200527.e3b212/src/libomemo_storage.c Examining data/libomemo-0.6.2+git20200527.e3b212/src/libomemo_storage.h Examining data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.h Examining data/libomemo-0.6.2+git20200527.e3b212/test/test_crypto.c Examining data/libomemo-0.6.2+git20200527.e3b212/test/test_libomemo.c Examining data/libomemo-0.6.2+git20200527.e3b212/test/test_storage.c FINAL RESULTS: data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:456:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. len = snprintf((void *) 0, 0, format, OMEMO_NS, OMEMO_NS_SEPARATOR, BUNDLE_PEP_NAME, OMEMO_NS_SEPARATOR_FINAL, bundle_p->device_id) + 1; data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:458:7: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (snprintf(node_value, len, format, OMEMO_NS, OMEMO_NS_SEPARATOR, BUNDLE_PEP_NAME, OMEMO_NS_SEPARATOR_FINAL, bundle_p->device_id) <= 0) { data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:615:16: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size_t len = snprintf((void *) 0, 0, format, OMEMO_NS, OMEMO_NS_SEPARATOR, BUNDLE_PEP_NAME, OMEMO_NS_SEPARATOR_FINAL, device_id); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:623:23: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size_t actual_len = snprintf(node_name, buf_len, format, OMEMO_NS, OMEMO_NS_SEPARATOR, BUNDLE_PEP_NAME, OMEMO_NS_SEPARATOR_FINAL, device_id); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:948:16: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size_t len = snprintf((void *) 0, 0, format, OMEMO_NS, OMEMO_NS_SEPARATOR, DEVICELIST_PEP_NAME); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:956:23: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size_t actual_len = snprintf(node_name, buf_len, format, OMEMO_NS, OMEMO_NS_SEPARATOR, DEVICELIST_PEP_NAME); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:399:12: [3] (random) g_random_int_range: 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. random = g_random_int_range(0, bundle_p->pre_keys_amount); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:401:23: [3] (random) random: 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. for (int i = 0; i < random; i++) { data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:930: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(cpy_p, curr_p->data, (sizeof(uint32_t))); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:1116:3: [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(msg_p->key_p + msg_p->key_len, tag_p, msg_p->tag_len); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:1483:3: [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(pt_str, pt_p, pt_len); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:158:59: [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 (strncmp(mxmlGetElement(next_node_p), expected_name, strlen(expected_name))) { data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:518:68: [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). ret_val = strncmp(mxmlGetElement(items_node_p), ITEMS_NODE_NAME, strlen(ITEMS_NODE_NAME)); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:661:30: [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). from_dup = g_strndup(from, strlen(from)); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:703:68: [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). ret_val = strncmp(mxmlGetElement(items_node_p), ITEMS_NODE_NAME, strlen(ITEMS_NODE_NAME)); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:715:66: [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). ret_val = strncmp(mxmlGetElement(item_node_p), ITEM_NODE_NAME, strlen(ITEM_NODE_NAME)); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:1104:66: [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). ret_val = crypto_p->aes_gcm_encrypt_func((uint8_t *) msg_text, strlen(msg_text), data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:1332:36: [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). char * ret = g_strndup(split[0], strlen(split[0])); data/libomemo-0.6.2+git20200527.e3b212/src/libomemo.c:1382:86: [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 (!strncmp(rid_string, mxmlElementGetAttr(key_node_p, KEY_NODE_RID_ATTR_NAME), strlen(rid_string))) { data/libomemo-0.6.2+git20200527.e3b212/test/test_crypto.c:38:26: [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). size_t plaintext_len = strlen(msg) + 1; ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 4411 in approximately 0.16 seconds (28265 lines/second) Physical Source Lines of Code (SLOC) = 3018 Hits@level = [0] 4 [1] 9 [2] 3 [3] 2 [4] 6 [5] 0 Hits@level+ = [0+] 24 [1+] 20 [2+] 11 [3+] 8 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 7.95229 [1+] 6.62691 [2+] 3.6448 [3+] 2.65076 [4+] 1.98807 [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.