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/pngnq-1.0/src/pngcomp.c
Examining data/pngnq-1.0/src/rwpng.c
Examining data/pngnq-1.0/src/colorspace.c
Examining data/pngnq-1.0/src/colorspace.h
Examining data/pngnq-1.0/src/pngnq.c
Examining data/pngnq-1.0/src/neuquant32.c
Examining data/pngnq-1.0/src/neuquant32.h
Examining data/pngnq-1.0/src/rwpng.h
Examining data/pngnq-1.0/src/errors.h

FINAL RESULTS:

data/pngnq-1.0/src/errors.h:10:28:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
#define PNGNQ_LOG_ERR(...)(syslog(LOG_ERR,\
data/pngnq-1.0/src/errors.h:12:5:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
    syslog(LOG_ERR, __VA_ARGS__); 
data/pngnq-1.0/src/errors.h:15:5:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
    syslog(LOG_WARNING, __VA_ARGS__);
data/pngnq-1.0/src/errors.h:17:27:  [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 PNGNQ_ERROR(...) (fprintf(stderr,\
data/pngnq-1.0/src/errors.h:19:5:  [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, __VA_ARGS__);\
data/pngnq-1.0/src/errors.h:24:5:  [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, __VA_ARGS__);\
data/pngnq-1.0/src/errors.h:28:42:  [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 PNGNQ_MESSAGE(...) {if(verbose) {fprintf(stderr,__VA_ARGS__);fflush(stderr);}}
data/pngnq-1.0/src/pngcomp.c:124:5:  [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,PNGCOMP_USAGE);
data/pngnq-1.0/src/pngcomp.c:139:7:  [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,PNGCOMP_USAGE);
data/pngnq-1.0/src/pngcomp.c:161:7:  [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,PNGCOMP_USAGE);
data/pngnq-1.0/src/pngnq.c:153:7:  [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,PNGNQ_USAGE);
data/pngnq-1.0/src/pngnq.c:186:7:  [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,PNGNQ_USAGE);
data/pngnq-1.0/src/rwpng.h:43:22:  [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 Trace(x)  {fprintf x ; fflush(stderr); fflush(stdout);}
data/pngnq-1.0/src/pngcomp.c:128:14:  [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.
  while((c = getopt(argc,argv,"hVvb:RL"))!=-1){
data/pngnq-1.0/src/pngnq.c:135:14:  [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.
  while((c = getopt(argc,argv,"hVvfn:s:d:e:g:Q:"))!=-1){
data/pngnq-1.0/src/pngcomp.c:143:19:  [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).
      blocksize = atoi(optarg);
data/pngnq-1.0/src/pngcomp.c:211: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).
  if((file1 = fopen(file1_name, "rb"))==NULL){
data/pngnq-1.0/src/pngcomp.c:217: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).
  if((file2 = fopen(file2_name, "rb"))==NULL){
data/pngnq-1.0/src/pngcomp.c:299: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).
  if((file1 = fopen(file1_name, "rb"))==NULL){
data/pngnq-1.0/src/pngcomp.c:305: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).
  if((file2 = fopen(file2_name, "rb"))==NULL){
data/pngnq-1.0/src/pngnq.c:138:23:  [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).
      sample_factor = atoi(optarg);
data/pngnq-1.0/src/pngnq.c:157:19:  [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).
      n_colours = atoi(optarg);
data/pngnq-1.0/src/pngnq.c:299:54:  [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.
static void remap_floyd(int cols, int rows, unsigned char map[MAXNETSIZE][4], unsigned int* remap,  uch **row_pointers, int quantization_method)
data/pngnq-1.0/src/pngnq.c:393:73:  [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.
static void remap_simple(unsigned int cols, unsigned int rows, unsigned char map[MAXNETSIZE][4], unsigned int* remap,  uch **row_pointers)
data/pngnq-1.0/src/pngnq.c:446:12:  [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 map[MAXNETSIZE][4];
data/pngnq-1.0/src/pngnq.c:462: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((infile = fopen(filename, "rb"))==NULL){
data/pngnq-1.0/src/pngnq.c:478:22:  [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 ((outfile = fopen(outname, "rb")) != NULL) {
data/pngnq-1.0/src/pngnq.c:485:20:  [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 ((outfile = fopen(outname, "wb")) == NULL) {
data/pngnq-1.0/src/pngnq.c:251:12:  [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).
  fn_len = strlen(infilename); 
data/pngnq-1.0/src/pngnq.c:252: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).
  ext_len = strlen(newext)+1; /* include the terminating NULL*/
data/pngnq-1.0/src/pngnq.c:255: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).
    dir_len = strlen(newdir);
data/pngnq-1.0/src/pngnq.c:269: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).
      fn_len = strlen(infilename);
data/pngnq-1.0/src/pngnq.c:274:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(newdir+dir_len,DIR_SEPARATOR_STR,1);
data/pngnq-1.0/src/pngnq.c:278:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(outname,newdir,dir_len);
data/pngnq-1.0/src/pngnq.c:287:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(outname+dir_len,infilename,fn_len);
data/pngnq-1.0/src/pngnq.c:291:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(outname+dir_len+fn_len-4, newext, ext_len);
data/pngnq-1.0/src/pngnq.c:293:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(outname+dir_len+fn_len, newext, ext_len);

ANALYSIS SUMMARY:

Hits = 37
Lines analyzed = 2631 in approximately 0.09 seconds (30921 lines/second)
Physical Source Lines of Code (SLOC) = 1649
Hits@level = [0]  49 [1]   9 [2]  13 [3]   2 [4]  13 [5]   0
Hits@level+ = [0+]  86 [1+]  37 [2+]  28 [3+]  15 [4+]  13 [5+]   0
Hits/KSLOC@level+ = [0+] 52.1528 [1+] 22.4378 [2+] 16.98 [3+] 9.09642 [4+] 7.88357 [5+]   0
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.