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/zpaq-7.15/zpaq.cpp
Examining data/zpaq-7.15/libzpaq.cpp
Examining data/zpaq-7.15/libzpaq.h

FINAL RESULTS:

data/zpaq-7.15/zpaq.cpp:516:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    chmod(filename, attr>>8);
data/zpaq-7.15/zpaq.cpp:397:17:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  if (mode!=RB) access|=GENERIC_WRITE;
data/zpaq-7.15/zpaq.cpp:402:45:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  return CreateFile(utow(filename).c_str(), access, share,
data/zpaq-7.15/zpaq.cpp:1077: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(
data/zpaq-7.15/libzpaq.cpp:685:6:  [3] (random) random:
  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.
void random(char* buf, int n) {
data/zpaq-7.15/libzpaq.h:1015:6:  [3] (random) random:
  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.
void random(char* buf, int n);
data/zpaq-7.15/zpaq.cpp:877:17:  [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.
  const char* p=getenv("NUMBER_OF_PROCESSORS");
data/zpaq-7.15/zpaq.cpp:2120:26:  [3] (random) random:
  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.
  if (password) libzpaq::random(salt, 32);
data/zpaq-7.15/zpaq.cpp:3113:32:  [3] (random) random:
  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.
    if (new_password) libzpaq::random(salt, 32);
data/zpaq-7.15/zpaq.cpp:3287:32:  [3] (random) random:
  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.
    if (new_password) libzpaq::random(salt, 32);
data/zpaq-7.15/libzpaq.cpp:557: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 ct[16];
data/zpaq-7.15/libzpaq.cpp:585: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 b[32];
data/zpaq-7.15/libzpaq.cpp:591: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(b, sha256.result(), 32);
data/zpaq-7.15/libzpaq.cpp:595: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(buf+i*32-32, sha256.result(), 32);
data/zpaq-7.15/libzpaq.cpp:603:3:  [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(x, b, 64);
data/zpaq-7.15/libzpaq.cpp:632:3:  [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(x, b+32*r-16, 64);
data/zpaq-7.15/libzpaq.cpp:636: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(&y[i*16], x, 64);
data/zpaq-7.15/libzpaq.cpp:638:27:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  for (int i=0; i<r; ++i) memcpy(b+i*16, &y[i*32], 64);
data/zpaq-7.15/libzpaq.cpp:639:27:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  for (int i=0; i<r; ++i) memcpy(b+(i+r)*16, &y[i*32+16], 64);
data/zpaq-7.15/libzpaq.cpp:647: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(&v[i*r*32], &x[0], r*128);
data/zpaq-7.15/libzpaq.cpp:687: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* in=fopen("/dev/urandom", "rb");
data/zpaq-7.15/libzpaq.cpp:1740: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(squasht+1376, ssquasht, 1344*2);
data/zpaq-7.15/libzpaq.cpp:2521:3:  [2] (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). Risk is low because the
  source is a constant string.
  strcat(s, "Config line ");
data/zpaq-7.15/libzpaq.cpp:2524:3:  [2] (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). Risk is low because the
  source is a constant string.
  strcat(s, " at ");
data/zpaq-7.15/libzpaq.cpp:2527:3:  [2] (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). Risk is low because the
  source is a constant string.
  strcat(s, ": ");
data/zpaq-7.15/libzpaq.cpp:2530:5:  [2] (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). Risk is low because the
  source is a constant string.
    strcat(s, ", expected: ");
data/zpaq-7.15/libzpaq.cpp:2563: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).
    if (in[2]=='+') r=atoi(in+3);
data/zpaq-7.15/libzpaq.cpp:2566:56:  [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).
  else if (in[0]=='-' || (in[0]>='0' && in[0]<='9')) r=atoi(in);
data/zpaq-7.15/libzpaq.cpp:2926: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[BUFSIZE];  // input buffer
data/zpaq-7.15/libzpaq.cpp:2986: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(sha1result, sha1.result(), 20);
data/zpaq-7.15/libzpaq.cpp:3562:39:  [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 const unsigned char jtab[2][4]={{5,4,2,7},{4,5,3,6}};
data/zpaq-7.15/libzpaq.cpp:6498: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 buf[BUFSIZE]; // output buffer
data/zpaq-7.15/libzpaq.cpp:6589:11:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  if (nr) memcpy(p, buf+rpos, nr);
data/zpaq-7.15/libzpaq.h:952: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 hbuf[20];    // result
data/zpaq-7.15/libzpaq.h:977: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 hbuf[32];         // result
data/zpaq-7.15/libzpaq.h:1368: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 sha1result[20];  // sha1 output
data/zpaq-7.15/libzpaq.h:1453:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    if (buf) memcpy(p+wpos, buf, n);
data/zpaq-7.15/libzpaq.h:1472: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.
    if (n>0 && buf) memcpy(buf, p+rpos, n);
data/zpaq-7.15/zpaq.cpp:393:4:  [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).
FP fopen(const char* filename, MODE mode) {
data/zpaq-7.15/zpaq.cpp:697:6:  [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).
  fp=fopen(next.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:715:8:  [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).
    fp=fopen(parti.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:724:6:  [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).
  fp=fopen(part1.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:730: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 salt[32], key[32];
data/zpaq-7.15/zpaq.cpp:743: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[BUFSIZE];  // I/O buffer
data/zpaq-7.15/zpaq.cpp:812: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 salt[32]={0};
data/zpaq-7.15/zpaq.cpp:813:6:  [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).
  fp=fopen(filename, RBPLUS);
data/zpaq-7.15/zpaq.cpp:825:8:  [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).
    fp=fopen(filename, WB);
data/zpaq-7.15/zpaq.cpp:829: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(salt, salt_, 32);
data/zpaq-7.15/zpaq.cpp:836: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[32];
data/zpaq-7.15/zpaq.cpp:857: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 *in=fopen("/proc/cpuinfo", "r");
data/zpaq-7.15/zpaq.cpp:866:11:  [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).
        c=atoi(s.c_str()+10);
data/zpaq-7.15/zpaq.cpp:878:13:  [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 (p) rc=atoi(p);
data/zpaq-7.15/zpaq.cpp:955: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 sha1[20];  // fragment hash
data/zpaq-7.15/zpaq.cpp:958:12:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    if (s) memcpy(sha1, s, 20);
data/zpaq-7.15/zpaq.cpp:1031: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 password_string[32]; // hash of -key argument
data/zpaq-7.15/zpaq.cpp:1039: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 new_password_string[32]; // -repack hashed password
data/zpaq-7.15/zpaq.cpp:1217:50:  [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 (i<argc-1 && isdigit(argv[i+1][0])) all=atoi(argv[++i]);
data/zpaq-7.15/zpaq.cpp:1220:53:  [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).
    else if (opt=="-fragment" && i<argc-1) fragment=atoi(argv[++i]);
data/zpaq-7.15/zpaq.cpp:1225: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(password_string, sha256.result(), 32);
data/zpaq-7.15/zpaq.cpp:1248: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(new_password_string, sha256.result(), 32);
data/zpaq-7.15/zpaq.cpp:1252:51:  [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).
    else if (opt=="-summary" && i<argc-1) summary=atoi(argv[++i]);
data/zpaq-7.15/zpaq.cpp:1253: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).
    else if (opt[1]=='s') summary=atoi(argv[i]+2);
data/zpaq-7.15/zpaq.cpp:1261:51:  [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).
    else if (opt=="-threads" && i<argc-1) threads=atoi(argv[++i]);
data/zpaq-7.15/zpaq.cpp:1262: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).
    else if (opt[1]=='t') threads=atoi(argv[i]+2);
data/zpaq-7.15/zpaq.cpp:1269:17:  [2] (integer) atol:
  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).
        version=atol(argv[i+1]);
data/zpaq-7.15/zpaq.cpp:1380: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 s[4]={0};
data/zpaq-7.15/zpaq.cpp:1459:15:  [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 sha1result[21]={0};
data/zpaq-7.15/zpaq.cpp:1532:17:  [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(ht[num+i].sha1, s, 20);
data/zpaq-7.15/zpaq.cpp:1605:13:  [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 sha1result[21]={0};
data/zpaq-7.15/zpaq.cpp:2063: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 zero[20]={0};
data/zpaq-7.15/zpaq.cpp:2119: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 salt[32]={0};  // encryption salt
data/zpaq-7.15/zpaq.cpp:2135: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).
      FP fp=fopen(index, RB);
data/zpaq-7.15/zpaq.cpp:2152: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).
        FP fp=fopen(partname.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:2166: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).
      FP fp=fopen(subpart(archive, 1).c_str(), RB);
data/zpaq-7.15/zpaq.cpp:2195:30:  [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).
  const int log_blocksize=20+atoi(method.c_str()+1);
data/zpaq-7.15/zpaq.cpp:2281: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).
      FP in=fopen(p->first.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:2290:7:  [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[BUFSIZE];
data/zpaq-7.15/zpaq.cpp:2358: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 o1prev[ON*256]={0};  // last ON order 1 predictions
data/zpaq-7.15/zpaq.cpp:2366: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 buf[BUFSIZE];
data/zpaq-7.15/zpaq.cpp:2374:10:  [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).
      in=fopen(p->first.c_str(), RB);
data/zpaq-7.15/zpaq.cpp:2392:7:  [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 sha1result[20]={0};  // fragment hash
data/zpaq-7.15/zpaq.cpp:2393:16:  [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 o1[256]={0};  // order 1 context -> predicted byte
data/zpaq-7.15/zpaq.cpp:2421: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(sha1result, sha1.result(), 20);
data/zpaq-7.15/zpaq.cpp:2438: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 o1ct[256]={0};  // counts of bytes in o1
data/zpaq-7.15/zpaq.cpp:2439:31:  [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 const unsigned char dt[256]={  // 32768/((i+1)*204)
data/zpaq-7.15/zpaq.cpp:2532:11:  [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(o1prev+256*(ON-1), o1, 256);
data/zpaq-7.15/zpaq.cpp:2721: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.
    static const char zero[20]={0};
data/zpaq-7.15/zpaq.cpp:2739:9:  [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).
  FP in=fopen(filename, RB);
data/zpaq-7.15/zpaq.cpp:2748: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[BUFSIZE];
data/zpaq-7.15/zpaq.cpp:2888: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 sha1result[20];
data/zpaq-7.15/zpaq.cpp:2890: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(sha1result, sha1.result(), 20);
data/zpaq-7.15/zpaq.cpp:2974:24:  [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).
              job.outf=fopen(filename.c_str(), WB);
data/zpaq-7.15/zpaq.cpp:2991: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).
            job.outf=fopen(filename.c_str(), RBPLUS);  // update existing file
data/zpaq-7.15/zpaq.cpp:3085: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[BUFSIZE];
data/zpaq-7.15/zpaq.cpp:3112: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 salt[32]={0};
data/zpaq-7.15/zpaq.cpp:3150: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 salt[32];
data/zpaq-7.15/zpaq.cpp:3152: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).
      FP fp=fopen(subpart(archive, 1).c_str(), RB);
data/zpaq-7.15/zpaq.cpp:3164: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.
      static char hdr[256]={0};  // Read C block
data/zpaq-7.15/zpaq.cpp:3176: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(hdr+hsize-34, 
data/zpaq-7.15/zpaq.cpp:3286: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 salt[32]={0};
data/zpaq-7.15/zpaq.cpp:3416:24:  [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).
                  outf=fopen(outname.c_str(), WB);
data/zpaq-7.15/zpaq.cpp:3436:13:  [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 sha1result[21];
data/zpaq-7.15/zpaq.cpp:3641:50:  [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 (all>0 && p->first.size()==all+1u && (v=atoi(p->first.c_str()))>0
data/zpaq-7.15/libzpaq.cpp:48:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int Reader::read(char* buf, int n) {
data/zpaq-7.15/libzpaq.cpp:887:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int ZPAQL::read(Reader* in2) {
data/zpaq-7.15/libzpaq.cpp:2267:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  z.read(&dec);
data/zpaq-7.15/libzpaq.cpp:2522:14:  [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 (int i=strlen(s), r=1000000; r; r/=10)  // append line number
data/zpaq-7.15/libzpaq.cpp:2525:14:  [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 (int i=strlen(s); i<40 && *in>' '; ++i)  // append token found
data/zpaq-7.15/libzpaq.cpp:2528:3:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
  strncat(s, msg, 40);  // append message
data/zpaq-7.15/libzpaq.cpp:2531:5:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
    strncat(s, expected, 20);  // append expected token if any
data/zpaq-7.15/libzpaq.cpp:2844:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  z.read(&m);
data/zpaq-7.15/libzpaq.cpp:2930:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int nr=in->read(buf, nbuf);
data/zpaq-7.15/libzpaq.cpp:3024:23:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while (in && (n=in->read((char*)sb.data(), bs))>0) {
data/zpaq-7.15/libzpaq.cpp:6541:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read(char* p, int n);
data/zpaq-7.15/libzpaq.cpp:6585:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int LZBuffer::read(char* p, int n) {
data/zpaq-7.15/libzpaq.h:867:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  virtual int read(char* buf, int n); // read to buf[n], return no. read
data/zpaq-7.15/libzpaq.h:1034:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read(Reader* in2);  // Read header
data/zpaq-7.15/libzpaq.h:1208:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      wpos=in ? in->read(&buf[0], BUFSIZE) : 0;
data/zpaq-7.15/libzpaq.h:1467:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read(char* buf, int n) {
data/zpaq-7.15/zpaq.cpp:648:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read(char* obuf, int len) {
data/zpaq-7.15/zpaq.cpp:861:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((c=getc(in))!=EOF) {
data/zpaq-7.15/zpaq.cpp:1071:8:  [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(DTMap::const_iterator p, const char* filename);
data/zpaq-7.15/zpaq.cpp:1381:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    const int nr=in.read(s, 4);
data/zpaq-7.15/zpaq.cpp:1556: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).
                const int64_t len=strlen(s);
data/zpaq-7.15/zpaq.cpp:2611:34:  [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).
      is.write(p->first.c_str(), strlen(p->first.c_str()));
data/zpaq-7.15/zpaq.cpp:2650:36:  [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).
        is.write(filename.c_str(), strlen(filename.c_str()));
data/zpaq-7.15/zpaq.cpp:2717: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.
bool Jidac::equal(DTMap::const_iterator p, const char* filename) {
data/zpaq-7.15/zpaq.cpp:3088:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int nr=in.read(buf, nc);
data/zpaq-7.15/zpaq.cpp:3167:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (in.read(hdr, hsize)!=hsize) error("EOF in header");
data/zpaq-7.15/zpaq.cpp:3206:52:  [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 (!repack && !dotest && force && !isdir && equal(p, fn.c_str())) {
data/zpaq-7.15/zpaq.cpp:3331:36:  [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).
        is.write(filename.c_str(), strlen(filename.c_str()));
data/zpaq-7.15/zpaq.cpp:3590:21:  [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 ((force && equal(p, p1->first.c_str()))

ANALYSIS SUMMARY:

Hits = 132
Lines analyzed = 12980 in approximately 0.42 seconds (30708 lines/second)
Physical Source Lines of Code (SLOC) = 9912
Hits@level = [0] 117 [1]  29 [2]  93 [3]   6 [4]   3 [5]   1
Hits@level+ = [0+] 249 [1+] 132 [2+] 103 [3+]  10 [4+]   4 [5+]   1
Hits/KSLOC@level+ = [0+] 25.1211 [1+] 13.3172 [2+] 10.3914 [3+] 1.00888 [4+] 0.403551 [5+] 0.100888
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.