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/r-cran-catools-1.18.0/src/runfunc.c
Examining data/r-cran-catools-1.18.0/src/GifTools.h
Examining data/r-cran-catools-1.18.0/src/GifTools.cpp
Examining data/r-cran-catools-1.18.0/src/Gif2R.cpp
Examining data/r-cran-catools-1.18.0/src/caTools_init.c

FINAL RESULTS:

data/r-cran-catools-1.18.0/src/GifTools.cpp:14:25:  [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.
  #define print         printf
data/r-cran-catools-1.18.0/src/GifTools.cpp:381: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(fname,filename);
data/r-cran-catools-1.18.0/src/GifTools.cpp:568: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(fname,filename);
data/r-cran-catools-1.18.0/src/GifTools.cpp:378: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 fname[256], sig[16], *q;
data/r-cran-catools-1.18.0/src/GifTools.cpp:383:24:  [2] (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). Risk is low because the source is a constant string.
  if (fname[i-4]=='.') strcpy(strrchr(fname,'.'),".gif");
data/r-cran-catools-1.18.0/src/GifTools.cpp:398:14:  [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 *fp = fopen(fname,"wb");
data/r-cran-catools-1.18.0/src/GifTools.cpp:404:45:  [2] (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). Risk is low because the source is a constant string.
  if (transparent>=0 || comment || Bands>1) strcpy(sig,"GIF89a"); else strcpy(sig,"GIF87a");
data/r-cran-catools-1.18.0/src/GifTools.cpp:404:72:  [2] (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). Risk is low because the source is a constant string.
  if (transparent>=0 || comment || Bands>1) strcpy(sig,"GIF89a"); else strcpy(sig,"GIF87a");
data/r-cran-catools-1.18.0/src/GifTools.cpp:498:33:  [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 (i=0; i<Height; i+=8) memcpy(tmp+Width*(row++), p+Width*i, Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:499:33:  [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 (i=4; i<Height; i+=8) memcpy(tmp+Width*(row++), p+Width*i, Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:500:33:  [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 (i=2; i<Height; i+=4) memcpy(tmp+Width*(row++), p+Width*i, Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:501:33:  [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 (i=1; i<Height; i+=2) memcpy(tmp+Width*(row++), p+Width*i, Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:526: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 buffer[3*255];
data/r-cran-catools-1.18.0/src/GifTools.cpp:546: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(data  , trg, n);
data/r-cran-catools-1.18.0/src/GifTools.cpp:547: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(data+n, src, nPixel*sizeof(uchar));
data/r-cran-catools-1.18.0/src/GifTools.cpp:562: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 version[7], fname[256], *p, *comment=0;
data/r-cran-catools-1.18.0/src/GifTools.cpp:570:24:  [2] (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). Risk is low because the source is a constant string.
  if (fname[i-4]=='.') strcpy(strrchr(fname,'.'),".gif");
data/r-cran-catools-1.18.0/src/GifTools.cpp:571:14:  [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 *fp = fopen(fname,"rb");
data/r-cran-catools-1.18.0/src/GifTools.cpp:625:18:  [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(p,comment,m);
data/r-cran-catools-1.18.0/src/GifTools.cpp:675: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(from, to, Width*Height);
data/r-cran-catools-1.18.0/src/GifTools.cpp:676:37:  [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 (i=0; i<Height; i+=8) memcpy(to+Width*i, from+Width*(row++), Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:677:37:  [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 (i=4; i<Height; i+=8) memcpy(to+Width*i, from+Width*(row++), Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:678:37:  [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 (i=2; i<Height; i+=4) memcpy(to+Width*i, from+Width*(row++), Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:679:37:  [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 (i=1; i<Height; i+=2) memcpy(to+Width*i, from+Width*(row++), Width);
data/r-cran-catools-1.18.0/src/GifTools.cpp:795:5:  [2] (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). Risk is low because the source is a constant string.
    strcpy(str, "hello world");
data/r-cran-catools-1.18.0/src/Gif2R.cpp:56: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(comment && strlen(comment)) { // if comment was found than pack it too
data/r-cran-catools-1.18.0/src/GifTools.cpp:48:19:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int BlockSize = fgetc(fp);
data/r-cran-catools-1.18.0/src/GifTools.cpp:307:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  depth = fgetc(fp);             // number of bits per data item (=pixel). Remains unchanged.
data/r-cran-catools-1.18.0/src/GifTools.cpp:382:24:  [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).
  i = static_cast<int>(strlen(fname));
data/r-cran-catools-1.18.0/src/GifTools.cpp:437: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).
  n = (comment ? static_cast<int>(strlen(comment)) : 0);
data/r-cran-catools-1.18.0/src/GifTools.cpp:569:25:  [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).
  i = static_cast<int>( strlen(fname));
data/r-cran-catools-1.18.0/src/GifTools.cpp:596:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    c = fgetc(fp);
data/r-cran-catools-1.18.0/src/GifTools.cpp:606:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        c = fgetc(fp);
data/r-cran-catools-1.18.0/src/GifTools.cpp:621: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).
            m = (comment ? static_cast<int>(strlen(comment)) : 0);
data/r-cran-catools-1.18.0/src/GifTools.cpp:629:16:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
               strncpy(comment+m, (char*) buffer, n);
data/r-cran-catools-1.18.0/src/GifTools.cpp:800:3:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  getchar();
data/r-cran-catools-1.18.0/src/runfunc.c:1021:3:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  getchar();

ANALYSIS SUMMARY:

Hits = 37
Lines analyzed = 1973 in approximately 0.10 seconds (20759 lines/second)
Physical Source Lines of Code (SLOC) = 1327
Hits@level = [0]  17 [1]  12 [2]  22 [3]   0 [4]   3 [5]   0
Hits@level+ = [0+]  54 [1+]  37 [2+]  25 [3+]   3 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 40.6933 [1+] 27.8824 [2+] 18.8395 [3+] 2.26074 [4+] 2.26074 [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.