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/filtergen-0.12.8/fg-util.c
Examining data/filtergen-0.12.8/filter.h
Examining data/filtergen-0.12.8/fg-iptables.c
Examining data/filtergen-0.12.8/fg-iptrestore.c
Examining data/filtergen-0.12.8/icmpent.c
Examining data/filtergen-0.12.8/icmpent.h
Examining data/filtergen-0.12.8/t/factorise.c
Examining data/filtergen-0.12.8/t/emit.c
Examining data/filtergen-0.12.8/t/convert.c
Examining data/filtergen-0.12.8/t/scan.c
Examining data/filtergen-0.12.8/t/parse.c
Examining data/filtergen-0.12.8/glue.c
Examining data/filtergen-0.12.8/parser.h
Examining data/filtergen-0.12.8/fg-ipfilter.c
Examining data/filtergen-0.12.8/util.h
Examining data/filtergen-0.12.8/resolver.h
Examining data/filtergen-0.12.8/filtergen.c
Examining data/filtergen-0.12.8/filter.c
Examining data/filtergen-0.12.8/fg-cisco.c
Examining data/filtergen-0.12.8/fg-ipchains.c
Examining data/filtergen-0.12.8/gen.c
Examining data/filtergen-0.12.8/resolver.c
Examining data/filtergen-0.12.8/ast.h
Examining data/filtergen-0.12.8/parser.c
Examining data/filtergen-0.12.8/scanner.c
Examining data/filtergen-0.12.8/input/iptables/ast.h
Examining data/filtergen-0.12.8/input/iptables/emit.c
Examining data/filtergen-0.12.8/input/iptables/parse.c
Examining data/filtergen-0.12.8/input/iptables/scan.c
Examining data/filtergen-0.12.8/expr.h
Examining data/filtergen-0.12.8/factoriser.c
Examining data/filtergen-0.12.8/factoriser.h

FINAL RESULTS:

data/filtergen-0.12.8/fg-util.c:32:10:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
  return strcat(s, n);
data/filtergen-0.12.8/filtergen.c:122:10:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  return vfprintf(outfile, fmt, args);
data/filtergen-0.12.8/filtergen.c:207:7:  [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(PACKAGE " " VERSION "\n");
data/filtergen-0.12.8/glue.c:49:3:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  fprintf(stderr, x)
data/filtergen-0.12.8/input/iptables/emit.c:18:3:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  fprintf(stderr, x)
data/filtergen-0.12.8/parser.c:660:19:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define YYFPRINTF fprintf
data/filtergen-0.12.8/scanner.c:611:67:  [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.
static void scan_err(const char * fmt, ...) __attribute__((format(printf, 1, 2)));
data/filtergen-0.12.8/scanner.c:2107:3:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  vfprintf(stderr, fmt, args);
data/filtergen-0.12.8/t/emit.c:17:3:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  fprintf(stderr, x)
data/filtergen-0.12.8/filtergen.c:150:25:  [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, long_options, NULL)
data/filtergen-0.12.8/filtergen.c:152:25:  [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(x, y, z)
data/filtergen-0.12.8/input/iptables/emit.c:135:15:  [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.
  EMITTRACE = getenv("EMITTRACE");
data/filtergen-0.12.8/input/iptables/parse.c:13:18:  [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.
  YYDEBUGTRACE = getenv("YYDEBUGTRACE");
data/filtergen-0.12.8/input/iptables/scan.c:61:7:  [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.
  if (getenv("srcdir")) {
data/filtergen-0.12.8/input/iptables/scan.c:62:11:  [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.
    chdir(getenv("srcdir"));
data/filtergen-0.12.8/t/convert.c:167:15:  [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.
  CONVTRACE = getenv("CONVTRACE");
data/filtergen-0.12.8/t/emit.c:316:15:  [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.
  EMITTRACE = getenv("EMITTRACE");
data/filtergen-0.12.8/t/factorise.c:206:15:  [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.
  FACTTRACE = getenv("FACTTRACE");
data/filtergen-0.12.8/t/parse.c:13:18:  [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.
  YYDEBUGTRACE = getenv("YYDEBUGTRACE");
data/filtergen-0.12.8/t/scan.c:119:7:  [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.
  if (getenv("srcdir")) {
data/filtergen-0.12.8/t/scan.c:120:15:  [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.
    if (chdir(getenv("srcdir")) < 0) {
data/filtergen-0.12.8/t/scan.c:121:58:  [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.
      fprintf(stderr, "error changing to path %s: %s\n", getenv("srcdir"),
data/filtergen-0.12.8/fg-util.c:47: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[100];
data/filtergen-0.12.8/filter.c:164: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 l[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
data/filtergen-0.12.8/filter.c:185: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(f->u.addrs.u.inet6.mask.s6_addr, l, sizeof l);
data/filtergen-0.12.8/filtergen.c:159: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[100];
data/filtergen-0.12.8/filtergen.c:224: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).
    outfile = fopen(ofn, "w");
data/filtergen-0.12.8/glue.c:36:18:  [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).
    if (!(file = fopen(filename, "r"))) {
data/filtergen-0.12.8/input/iptables/emit.c:136: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).
  emittrace = EMITTRACE ? atoi(EMITTRACE) : 0;
data/filtergen-0.12.8/input/iptables/parse.c:14:28:  [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).
  yydebug = YYDEBUGTRACE ? atoi(YYDEBUGTRACE) : 0;
data/filtergen-0.12.8/parser.c:882: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
data/filtergen-0.12.8/parser.c:1057: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 yymsgbuf[128];
data/filtergen-0.12.8/scanner.c:2120: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).
  if (!(f = fopen(fn, "r"))) {
data/filtergen-0.12.8/t/convert.c:168: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).
  convtrace = CONVTRACE ? atoi(CONVTRACE) : 0;
data/filtergen-0.12.8/t/emit.c:317: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).
  emittrace = EMITTRACE ? atoi(EMITTRACE) : 0;
data/filtergen-0.12.8/t/factorise.c:207: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).
  facttrace = FACTTRACE ? atoi(FACTTRACE) : 0;
data/filtergen-0.12.8/t/parse.c:14:28:  [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).
  yydebug = YYDEBUGTRACE ? atoi(YYDEBUGTRACE) : 0;
data/filtergen-0.12.8/fg-util.c:30:7:  [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).
  l = strlen(s) + strlen(n) + 1;
data/filtergen-0.12.8/fg-util.c:30: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).
  l = strlen(s) + strlen(n) + 1;
data/filtergen-0.12.8/parser.c:791: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).
#define yystrlen strlen
data/filtergen-0.12.8/scanner.c:719:14:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
data/filtergen-0.12.8/scanner.c:1842: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).
	return yy_scan_bytes(yystr,strlen(yystr) );

ANALYSIS SUMMARY:

Hits = 42
Lines analyzed = 9935 in approximately 0.37 seconds (26937 lines/second)
Physical Source Lines of Code (SLOC) = 7414
Hits@level = [0] 259 [1]   5 [2]  15 [3]  13 [4]   9 [5]   0
Hits@level+ = [0+] 301 [1+]  42 [2+]  37 [3+]  22 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 40.5989 [1+] 5.66496 [2+] 4.99056 [3+] 2.96736 [4+] 1.21392 [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.