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/gperf-3.1/lib/getline.cc
Examining data/gperf-3.1/lib/getline.h
Examining data/gperf-3.1/lib/getopt.c
Examining data/gperf-3.1/lib/getopt.h
Examining data/gperf-3.1/lib/getopt1.c
Examining data/gperf-3.1/lib/hash.cc
Examining data/gperf-3.1/lib/hash.h
Examining data/gperf-3.1/src/bool-array.cc
Examining data/gperf-3.1/src/bool-array.h
Examining data/gperf-3.1/src/hash-table.cc
Examining data/gperf-3.1/src/hash-table.h
Examining data/gperf-3.1/src/input.cc
Examining data/gperf-3.1/src/input.h
Examining data/gperf-3.1/src/keyword-list.cc
Examining data/gperf-3.1/src/keyword-list.h
Examining data/gperf-3.1/src/keyword.cc
Examining data/gperf-3.1/src/keyword.h
Examining data/gperf-3.1/src/main.cc
Examining data/gperf-3.1/src/options.cc
Examining data/gperf-3.1/src/options.h
Examining data/gperf-3.1/src/output.cc
Examining data/gperf-3.1/src/output.h
Examining data/gperf-3.1/src/positions.cc
Examining data/gperf-3.1/src/positions.h
Examining data/gperf-3.1/src/search.cc
Examining data/gperf-3.1/src/search.h
Examining data/gperf-3.1/src/version.cc
Examining data/gperf-3.1/src/version.h
Examining data/gperf-3.1/tests/test.c
Examining data/gperf-3.1/tests/test2.c

FINAL RESULTS:

data/gperf-3.1/src/output.cc:250:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy (combined_name, prefix);
data/gperf-3.1/src/output.cc:251:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy (combined_name + strlen (prefix), name);
data/gperf-3.1/src/output.cc:317:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf (option[KRC] ?
data/gperf-3.1/src/output.cc:368:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf (option[KRC] ?
data/gperf-3.1/src/output.cc:429:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf (option[KRC] ?
data/gperf-3.1/src/output.cc:832:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf (option[KRC] ?
data/gperf-3.1/src/output.cc:1988:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf (option[KRC] ?
data/gperf-3.1/lib/getopt.c:197:14:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
extern char *getenv ();
data/gperf-3.1/lib/getopt.c:367:21:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  posixly_correct = getenv ("POSIXLY_CORRECT");
data/gperf-3.1/lib/getopt.c:927:1:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
getopt (int argc, char *const *argv, const char *optstring)
data/gperf-3.1/lib/getopt.c:952:11:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
      c = getopt (argc, argv, "abc:d:0123456789");
data/gperf-3.1/lib/getopt.h:97:9:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
#define getopt(x,y,z) getopt_long(x, y, z, (const struct option *) 0, (int *) 0)
data/gperf-3.1/lib/getopt.h:97:23:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
#define getopt(x,y,z) getopt_long(x, y, z, (const struct option *) 0, (int *) 0)
data/gperf-3.1/lib/getopt.h:103:12:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt (int argc, char *const *argv, const char *shortopts);
data/gperf-3.1/lib/getopt.h:105:12:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt ();
data/gperf-3.1/lib/getopt.h:108:12:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
data/gperf-3.1/lib/getopt1.c:53:1:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
getopt_long (int argc, char *const *argv, const char *options,
data/gperf-3.1/lib/getopt1.c:99:11:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
      c = getopt_long (argc, argv, "abc:d:0123456789",
data/gperf-3.1/src/options.cc:743:13:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
            getopt_long (_argument_count, _argument_vector,
data/gperf-3.1/src/search.cc:903: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 (static_cast<long>(time (0)));
data/gperf-3.1/lib/getline.cc:76:15:  [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 (new_line, *lineptr, read_pos - *lineptr);
data/gperf-3.1/src/input.cc:279:11:  [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.
    const char *separator[2] = { NULL, NULL };
data/gperf-3.1/src/input.cc:566:48:  [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).
                    option.set_total_switches (atoi (arg));
data/gperf-3.1/src/input.cc:597:15:  [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 (new_struct_decl, struct_decl, old_len);
data/gperf-3.1/src/input.cc:598:13:  [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 (new_struct_decl + old_len, line, line_len);
data/gperf-3.1/src/input.cc:607:15:  [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 (new_struct_decl_linenos, struct_decl_linenos,
data/gperf-3.1/src/input.cc:687:19:  [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 (new_struct_decl, p, len + 1);
data/gperf-3.1/src/input.cc:713:15:  [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 (new_struct_decl, struct_decl, old_len);
data/gperf-3.1/src/input.cc:733: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 (struct_tag, struct_decl, struct_tag_length);
data/gperf-3.1/src/input.cc:740: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 (return_type, struct_decl, struct_tag_length);
data/gperf-3.1/src/input.cc:926:21:  [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 (line_rest, lp, line_end - lp);
data/gperf-3.1/src/input.cc:956:29:  [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 (line_rest, lp, line_end - lp);
data/gperf-3.1/src/keyword.cc:150:1:  [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 empty_string[1] = "";
data/gperf-3.1/src/keyword.h:104:8:  [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.
extern char empty_string[1];
data/gperf-3.1/src/options.cc:810:40:  [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).
            if ((_initial_asso_value = atoi (/*getopt*/optarg)) < 0)
data/gperf-3.1/src/options.cc:823:26:  [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).
            if ((_jump = atoi (/*getopt*/optarg)) < 0)
data/gperf-3.1/src/options.cc:913:37:  [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).
            if ((_asso_iterations = atoi (/*getopt*/optarg)) < 0)
data/gperf-3.1/src/options.cc:998:31:  [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).
            _total_switches = atoi (/*getopt*/optarg);
data/gperf-3.1/src/search.cc:682:19:  [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 (tryal, current, _max_key_len * sizeof (unsigned int));
data/gperf-3.1/src/search.cc:691:23:  [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 (best, tryal, _max_key_len * sizeof (unsigned int));
data/gperf-3.1/src/search.cc:699:19:  [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 (current, best, _max_key_len * sizeof (unsigned int));
data/gperf-3.1/src/search.cc:1184: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 (step->_undetermined, undetermined, _alpha_size*sizeof(bool));
data/gperf-3.1/src/search.cc:1547:15:  [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 (best_asso_values, _asso_values,
data/gperf-3.1/src/search.cc:1567:7:  [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 (_asso_values, best_asso_values,
data/gperf-3.1/tests/test.c:18:3:  [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 buf[MAX_LEN];
data/gperf-3.1/tests/test2.c:32:3:  [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 buf[2*MAX_LEN];
data/gperf-3.1/lib/getline.cc:58:24:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      register int c = getc (stream);
data/gperf-3.1/lib/getopt.c:213:15:  [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).
extern size_t strlen (const char *);
data/gperf-3.1/lib/getopt.c:398: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).
	      int len = nonoption_flags_max_len = strlen (orig_str);
data/gperf-3.1/lib/getopt.c:614: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).
		== (unsigned int) strlen (p->name))
data/gperf-3.1/lib/getopt.c:638:16:  [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).
	  nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:670:17:  [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).
		  nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:686:17:  [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).
		  nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:691:16:  [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).
	  nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:802: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).
	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
data/gperf-3.1/lib/getopt.c:825:18:  [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).
	    nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:845:19:  [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).
		    nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:859:19:  [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).
		    nextchar += strlen (nextchar);
data/gperf-3.1/lib/getopt.c:863:18:  [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).
	    nextchar += strlen (nextchar);
data/gperf-3.1/src/hash-table.cc:127:13:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
Hash_Table::equal (KeywordExt *item1, KeywordExt *item2) const
data/gperf-3.1/src/hash-table.cc:156:11:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
      if (equal (_table[probe], item))
data/gperf-3.1/src/hash-table.h:61:25:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
  bool                  equal (KeywordExt *item1, KeywordExt *item2) const;
data/gperf-3.1/src/input.cc:592: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).
            size_t old_len = (struct_decl ? strlen (struct_decl) : 0);
data/gperf-3.1/src/input.cc:685:32:  [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 len = strlen (p);
data/gperf-3.1/src/input.cc:694:42:  [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).
            for (char *p = struct_decl + strlen (struct_decl); p > struct_decl;)
data/gperf-3.1/src/input.cc:709:28:  [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 old_len = strlen (struct_decl);
data/gperf-3.1/src/output.cc:249: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).
  DYNAMIC_ARRAY (combined_name, char, strlen (prefix) + strlen (name) + 1);
data/gperf-3.1/src/output.cc:249:57:  [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).
  DYNAMIC_ARRAY (combined_name, char, strlen (prefix) + strlen (name) + 1);
data/gperf-3.1/src/output.cc:251:27:  [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).
  strcpy (combined_name + strlen (prefix), name);
data/gperf-3.1/src/output.cc:525: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).
      output_string (file_name, strlen (file_name));
data/gperf-3.1/src/output.cc:538:19:  [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 (type_string[strlen(type_string)-1] == '*')
data/gperf-3.1/src/output.cc:1192:11:  [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 (temp->_rest) > 0)
data/gperf-3.1/src/output.cc:1208:27:  [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 (option.get_initializer_suffix()));
data/gperf-3.1/tests/test.c:22:11:  [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 (buf) > 0 && buf[strlen (buf) - 1] == '\n')
data/gperf-3.1/tests/test.c:22:35:  [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 (buf) > 0 && buf[strlen (buf) - 1] == '\n')
data/gperf-3.1/tests/test.c:23: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).
        buf[strlen (buf) - 1] = '\0';
data/gperf-3.1/tests/test.c:25: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).
      if (in_word_set (buf, strlen (buf)))

ANALYSIS SUMMARY:

Hits = 77
Lines analyzed = 9714 in approximately 0.43 seconds (22545 lines/second)
Physical Source Lines of Code (SLOC) = 6533
Hits@level = [0] 496 [1]  31 [2]  26 [3]  13 [4]   7 [5]   0
Hits@level+ = [0+] 573 [1+]  77 [2+]  46 [3+]  20 [4+]   7 [5+]   0
Hits/KSLOC@level+ = [0+] 87.7086 [1+] 11.7863 [2+] 7.04118 [3+] 3.06138 [4+] 1.07148 [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.