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/python-datrie-0.8.2/libdatrie/datrie/alpha-map-private.h Examining data/python-datrie-0.8.2/libdatrie/datrie/alpha-map.c Examining data/python-datrie-0.8.2/libdatrie/datrie/alpha-map.h Examining data/python-datrie-0.8.2/libdatrie/datrie/darray.c Examining data/python-datrie-0.8.2/libdatrie/datrie/darray.h Examining data/python-datrie-0.8.2/libdatrie/datrie/dstring-private.h Examining data/python-datrie-0.8.2/libdatrie/datrie/dstring.c Examining data/python-datrie-0.8.2/libdatrie/datrie/dstring.h Examining data/python-datrie-0.8.2/libdatrie/datrie/fileutils.c Examining data/python-datrie-0.8.2/libdatrie/datrie/fileutils.h Examining data/python-datrie-0.8.2/libdatrie/datrie/tail.c Examining data/python-datrie-0.8.2/libdatrie/datrie/tail.h Examining data/python-datrie-0.8.2/libdatrie/datrie/trie-private.h Examining data/python-datrie-0.8.2/libdatrie/datrie/trie-string.c Examining data/python-datrie-0.8.2/libdatrie/datrie/trie-string.h Examining data/python-datrie-0.8.2/libdatrie/datrie/trie.c Examining data/python-datrie-0.8.2/libdatrie/datrie/trie.h Examining data/python-datrie-0.8.2/libdatrie/datrie/triedefs.h Examining data/python-datrie-0.8.2/libdatrie/datrie/typedefs.h Examining data/python-datrie-0.8.2/libdatrie/tests/test_file.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_iterator.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_nonalpha.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_null_trie.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_store-retrieve.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_term_state.c Examining data/python-datrie-0.8.2/libdatrie/tests/test_walk.c Examining data/python-datrie-0.8.2/libdatrie/tests/utils.c Examining data/python-datrie-0.8.2/libdatrie/tests/utils.h Examining data/python-datrie-0.8.2/libdatrie/tools/trietool.c FINAL RESULTS: data/python-datrie-0.8.2/libdatrie/tests/test_store-retrieve.c:83:5: [3] (random) srand: 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. srand (time (NULL)); data/python-datrie-0.8.2/libdatrie/datrie/dstring.c:109: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 (dst->val, src->val, (src->str_len + 1) * src->char_size); data/python-datrie-0.8.2/libdatrie/datrie/dstring.c:129: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 ((char *)dst->val + (dst->char_size * dst->str_len), src->val, data/python-datrie-0.8.2/libdatrie/datrie/dstring.c:143: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 ((char *)ds->val + (ds->char_size * ds->str_len), data, data/python-datrie-0.8.2/libdatrie/datrie/dstring.c:157: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 ((char *)ds->val + (ds->char_size * ds->str_len), data, data/python-datrie-0.8.2/libdatrie/datrie/fileutils.c:41:14: [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. unsigned char buff[4]; data/python-datrie-0.8.2/libdatrie/datrie/fileutils.c:54:14: [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. unsigned char buff[4]; data/python-datrie-0.8.2/libdatrie/datrie/fileutils.c:67:14: [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. unsigned char buff[2]; data/python-datrie-0.8.2/libdatrie/datrie/fileutils.c:80:14: [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. unsigned char buff[2]; data/python-datrie-0.8.2/libdatrie/datrie/trie.c:166:17: [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). trie_file = fopen (path, "rb"); data/python-datrie-0.8.2/libdatrie/datrie/trie.c:252:12: [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 = fopen (path, "wb+"); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:159:18: [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. unsigned char b[4]; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:166:9: [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 ((char *) &in[res], b, 4); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:187: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 buff[256]; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:199:15: [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). sbm = fopen (buff, "r"); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:237:9: [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 path[256]; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:327:35: [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). data = (opt_idx < argc) ? atoi (argv[opt_idx++]) : TRIE_DATA_ERROR; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:346: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 line[256]; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:379:13: [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). input = fopen (input_name, "r"); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:403:42: [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). data_val = ('\0' != *data) ? atoi (data) : TRIE_DATA_ERROR; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:448: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 line[256]; data/python-datrie-0.8.2/libdatrie/tools/trietool.c:481:13: [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). input = fopen (input_name, "r"); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:538: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 key_locale[1024]; data/python-datrie-0.8.2/libdatrie/datrie/alpha-map.c:546: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). alpha_str = (AlphaChar *) malloc ((strlen ((const char *)str) + 1) data/python-datrie-0.8.2/libdatrie/datrie/tail.c:239:39: [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). length = t->tails[i].suffix ? strlen ((const char *)t->tails[i].suffix) data/python-datrie-0.8.2/libdatrie/datrie/trie-string.c:91: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). str, strlen ((const char *)str)); data/python-datrie-0.8.2/libdatrie/datrie/trie.c:1040:46: [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 ((const char *)tail_str) data/python-datrie-0.8.2/libdatrie/datrie/trie.c:1057: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). * (key_len + strlen ((const char *)tail_str) + 1) data/python-datrie-0.8.2/libdatrie/tools/trietool.c:117:23: [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 in_left = strlen (in); data/python-datrie-0.8.2/libdatrie/tools/trietool.c:596:13: [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). p = s + strlen (s) - 1; ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 6722 in approximately 0.21 seconds (31281 lines/second) Physical Source Lines of Code (SLOC) = 3794 Hits@level = [0] 177 [1] 7 [2] 22 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 207 [1+] 30 [2+] 23 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 54.5598 [1+] 7.90722 [2+] 6.0622 [3+] 0.263574 [4+] 0 [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.