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/libdatrie-0.2.12/tests/test_nonalpha.c
Examining data/libdatrie-0.2.12/tests/test_null_trie.c
Examining data/libdatrie-0.2.12/tests/test_walk.c
Examining data/libdatrie-0.2.12/tests/test_term_state.c
Examining data/libdatrie-0.2.12/tests/utils.h
Examining data/libdatrie-0.2.12/tests/test_iterator.c
Examining data/libdatrie-0.2.12/tests/test_store-retrieve.c
Examining data/libdatrie-0.2.12/tests/test_byte_alpha.c
Examining data/libdatrie-0.2.12/tests/test_file.c
Examining data/libdatrie-0.2.12/tests/utils.c
Examining data/libdatrie-0.2.12/tools/trietool.c
Examining data/libdatrie-0.2.12/datrie/fileutils.h
Examining data/libdatrie-0.2.12/datrie/triedefs.h
Examining data/libdatrie-0.2.12/datrie/fileutils.c
Examining data/libdatrie-0.2.12/datrie/darray.h
Examining data/libdatrie-0.2.12/datrie/alpha-map-private.h
Examining data/libdatrie-0.2.12/datrie/trie.h
Examining data/libdatrie-0.2.12/datrie/trie-string.c
Examining data/libdatrie-0.2.12/datrie/dstring.c
Examining data/libdatrie-0.2.12/datrie/dstring-private.h
Examining data/libdatrie-0.2.12/datrie/alpha-map.h
Examining data/libdatrie-0.2.12/datrie/typedefs.h
Examining data/libdatrie-0.2.12/datrie/darray.c
Examining data/libdatrie-0.2.12/datrie/tail.h
Examining data/libdatrie-0.2.12/datrie/dstring.h
Examining data/libdatrie-0.2.12/datrie/trie.c
Examining data/libdatrie-0.2.12/datrie/alpha-map.c
Examining data/libdatrie-0.2.12/datrie/trie-private.h
Examining data/libdatrie-0.2.12/datrie/trie-string.h
Examining data/libdatrie-0.2.12/datrie/tail.c

FINAL RESULTS:

data/libdatrie-0.2.12/tools/trietool.c:188:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf (full_path_buff, "%s/%s%s", path, name, ext);
data/libdatrie-0.2.12/tests/test_store-retrieve.c:84: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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/tests/test_store-retrieve.c:91:38:  [2] (buffer) wchar_t:
  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.
        printf ("Deleting '%ls'\n", (wchar_t *)dict_src[i].key);
data/libdatrie-0.2.12/tests/test_store-retrieve.c:93:50:  [2] (buffer) wchar_t:
  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.
            printf ("Failed to delete '%ls'\n", (wchar_t *)dict_src[i].key);
data/libdatrie-0.2.12/tools/trietool.c:158: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/libdatrie-0.2.12/tools/trietool.c:165: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/libdatrie-0.2.12/tools/trietool.c:195: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/libdatrie-0.2.12/tools/trietool.c:207: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 (path_name, "r");
data/libdatrie-0.2.12/tools/trietool.c:336: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/libdatrie-0.2.12/tools/trietool.c:355: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/libdatrie-0.2.12/tools/trietool.c:388: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/libdatrie-0.2.12/tools/trietool.c:412: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/libdatrie-0.2.12/tools/trietool.c:457: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/libdatrie-0.2.12/tools/trietool.c:490: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/libdatrie-0.2.12/tools/trietool.c:547: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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/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/libdatrie-0.2.12/tools/trietool.c:116: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/libdatrie-0.2.12/tools/trietool.c:186:21:  [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).
    int full_size = strlen (path) + strlen (name) + strlen (ext) + 2;
data/libdatrie-0.2.12/tools/trietool.c:186:37:  [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).
    int full_size = strlen (path) + strlen (name) + strlen (ext) + 2;
data/libdatrie-0.2.12/tools/trietool.c:186:53:  [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).
    int full_size = strlen (path) + strlen (name) + strlen (ext) + 2;
data/libdatrie-0.2.12/tools/trietool.c:621: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 = 35
Lines analyzed = 6878 in approximately 0.29 seconds (24074 lines/second)
Physical Source Lines of Code (SLOC) = 3908
Hits@level = [0] 192 [1]  10 [2]  23 [3]   1 [4]   1 [5]   0
Hits@level+ = [0+] 227 [1+]  35 [2+]  25 [3+]   2 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 58.086 [1+] 8.95599 [2+] 6.39713 [3+] 0.511771 [4+] 0.255885 [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.