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/gp2c-0.0.12/src/gentype.c
Examining data/gp2c-0.0.12/src/node.c
Examining data/gp2c-0.0.12/src/toplevel.c
Examining data/gp2c-0.0.12/src/funcdesc.c
Examining data/gp2c-0.0.12/src/parse.h
Examining data/gp2c-0.0.12/src/patchfunc.h
Examining data/gp2c-0.0.12/src/stack.h
Examining data/gp2c-0.0.12/src/lang.c
Examining data/gp2c-0.0.12/src/genblock.c
Examining data/gp2c-0.0.12/src/topfunc.c
Examining data/gp2c-0.0.12/src/gencast.c
Examining data/gp2c-0.0.12/src/type.h
Examining data/gp2c-0.0.12/src/printnode.c
Examining data/gp2c-0.0.12/src/funcspec.c
Examining data/gp2c-0.0.12/src/header.h
Examining data/gp2c-0.0.12/src/genfunc.c
Examining data/gp2c-0.0.12/src/moveblock.c
Examining data/gp2c-0.0.12/src/util.c
Examining data/gp2c-0.0.12/src/gencode.c
Examining data/gp2c-0.0.12/src/stack.c
Examining data/gp2c-0.0.12/src/gerepile.c
Examining data/gp2c-0.0.12/src/optable.h
Examining data/gp2c-0.0.12/src/context.c
Examining data/gp2c-0.0.12/src/gp2c.c
Examining data/gp2c-0.0.12/src/varlist.c
Examining data/gp2c-0.0.12/src/parse.c

FINAL RESULTS:

data/gp2c-0.0.12/src/funcspec.c:1473:9:  [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(fout,gp->spec==GPbreak?"break":"continue");
data/gp2c-0.0.12/src/gencode.c:307:3:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  sprintf(modb,PARI_MODULE_BUILD,file,file,file,file);
data/gp2c-0.0.12/src/gp2c.c:166:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(tmplib,"%s%s.so",lib[0]=='/'?"":"./",lib);
data/gp2c-0.0.12/src/lang.c:993:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(t,"%s.gp",s);
data/gp2c-0.0.12/src/node.c:283:11:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
          sprintf(q,"%c_%s",s[0],s+1);
data/gp2c-0.0.12/src/node.c:292:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(q,"%s%s",optprefix,s);
data/gp2c-0.0.12/src/node.c:303:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(p,"_.%s",s);
data/gp2c-0.0.12/src/parse.c:922:21:  [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/gp2c-0.0.12/src/topfunc.c:34:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(s,"fun_%s",name);
data/gp2c-0.0.12/src/toplevel.c:41:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(name,"%s",initname);
data/gp2c-0.0.12/src/util.c:49: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,format,ap);
data/gp2c-0.0.12/src/util.c:66:5:  [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,format,ap);
data/gp2c-0.0.12/src/gp2c.c:172: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.
  if (!(descfile=getenv("GP2C_FUNC_DSC")))
data/gp2c-0.0.12/src/gp2c.c:347: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.
  while((c=getopt(argc,argv,"gi:hflo:p:s:StvydCGLTVW"))!=-1)
data/gp2c-0.0.12/src/gp2c.c:368:24:  [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 (!(descfile=getenv("GP2C_FUNC_DSC")))
data/gp2c-0.0.12/src/funcdesc.c:45:14:  [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).
    aa->misc=atol(s);
data/gp2c-0.0.12/src/funcdesc.c:133:10:  [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).
  return atol(buf);
data/gp2c-0.0.12/src/funcdesc.c:161: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[BUFFER_SIZE];
data/gp2c-0.0.12/src/funcdesc.c:163: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 (!(dfile=fopen(descfile,"r")))
data/gp2c-0.0.12/src/funcdesc.c:723: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[STACKSZ];
data/gp2c-0.0.12/src/funcspec.c:358: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[64];
data/gp2c-0.0.12/src/funcspec.c:359:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(buf,"iter%d",iterlev);
data/gp2c-0.0.12/src/funcspec.c:1122: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[64];
data/gp2c-0.0.12/src/funcspec.c:1124:7:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
      sprintf(buf,"prec%d",++preclevel);
data/gp2c-0.0.12/src/funcspec.c:1134: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[64];
data/gp2c-0.0.12/src/funcspec.c:1136:7:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
      sprintf(buf,"bitprec%d",++preclevel);
data/gp2c-0.0.12/src/genblock.c:28: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 s[33];
data/gp2c-0.0.12/src/genblock.c:29:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(s,"%d",newprivvar++);
data/gp2c-0.0.12/src/genfunc.c:131: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[64];
data/gp2c-0.0.12/src/genfunc.c:132:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(buf, "bitprec%d", level);
data/gp2c-0.0.12/src/genfunc.c:147: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[64];
data/gp2c-0.0.12/src/genfunc.c:148:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(buf, "bitprec%d", level);
data/gp2c-0.0.12/src/genfunc.c:839: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 s[33];
data/gp2c-0.0.12/src/genfunc.c:840:7:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
      sprintf(s,"%c%d",(ctype[t]==Vgen?'p':'l'),newcvar++);
data/gp2c-0.0.12/src/gp2c.c:355: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).
      indentlevel=atoi(optarg);
data/gp2c-0.0.12/src/gp2c.c:432: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).
    if ((fin=fopen(infile,"r"))==NULL)
data/gp2c-0.0.12/src/gp2c.c:438:25:  [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 && ((fout=fopen(outfile,"w"))==NULL))
data/gp2c-0.0.12/src/lang.c:989: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).
  yyin = fopen(s,"r");
data/gp2c-0.0.12/src/lang.c:994: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).
    yyin = fopen(t,"r");
data/gp2c-0.0.12/src/parse.c:1168: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
data/gp2c-0.0.12/src/parse.c:1355: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 yymsgbuf[128];
data/gp2c-0.0.12/src/stack.c:154: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((char *)*(sdat)+s->n*s->size,*tdat,t->n*t->size);
data/gp2c-0.0.12/src/topfunc.c:26: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 s[33];
data/gp2c-0.0.12/src/topfunc.c:27:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(s,"anon_%d",newanonvar++);
data/gp2c-0.0.12/src/funcdesc.c:85: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).
    aa.str=xstrndup(s+1,strlen(s)-2);
data/gp2c-0.0.12/src/funcdesc.c:127: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).
  buf[strlen(buf)-1]=0;
data/gp2c-0.0.12/src/funcdesc.c:174:9:  [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/gp2c-0.0.12/src/funcdesc.c:700: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).
          if (l==strlen(name) && !strncmp(ps,name,l))
data/gp2c-0.0.12/src/gencode.c:289: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).
    long n = strlen(outfile);
data/gp2c-0.0.12/src/gencode.c:306: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).
  modb = malloc(strlen(PARI_MODULE_BUILD)+4*strlen(file)+1);
data/gp2c-0.0.12/src/gencode.c:306: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).
  modb = malloc(strlen(PARI_MODULE_BUILD)+4*strlen(file)+1);
data/gp2c-0.0.12/src/genfunc.c:72:9:  [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(f)==n && !strncmp(s,f,n))
data/gp2c-0.0.12/src/gp2c.c:165: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).
  tmplib=(char*)calloc(strlen(lib)+6,sizeof(*lib));
data/gp2c-0.0.12/src/lang.c:748: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/gp2c-0.0.12/src/lang.c:983:8:  [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).
  ls = strlen(s);
data/gp2c-0.0.12/src/lang.c:992: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).
    char *t=(char*)malloc(strlen(s)+4);
data/gp2c-0.0.12/src/lang.c:2106: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).
	return yy_scan_bytes(yystr,(int) strlen(yystr) );
data/gp2c-0.0.12/src/node.c:282: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).
          char *q=calloc(sizeof(*s),2+strlen(s));
data/gp2c-0.0.12/src/node.c:291:31:  [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).
    char *q=calloc(sizeof(*s),strlen(optprefix)+1+strlen(s));
data/gp2c-0.0.12/src/node.c:291: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).
    char *q=calloc(sizeof(*s),strlen(optprefix)+1+strlen(s));
data/gp2c-0.0.12/src/node.c:302: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).
  p=calloc(sizeof(*s),3+strlen(s));
data/gp2c-0.0.12/src/node.c:437:9:  [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(t)==n && !strncmp(s,t,n))
data/gp2c-0.0.12/src/parse.c:1068: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).
#   define yystrlen strlen
data/gp2c-0.0.12/src/topfunc.c:33:22:  [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).
  char *s = malloc(5+strlen(name));
data/gp2c-0.0.12/src/toplevel.c:28:10:  [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).
  long l=strlen(s);
data/gp2c-0.0.12/src/toplevel.c:40: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).
  name=calloc(strlen(initname)+strlen(absname)+1,sizeof(*name));
data/gp2c-0.0.12/src/toplevel.c:40: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).
  name=calloc(strlen(initname)+strlen(absname)+1,sizeof(*name));
data/gp2c-0.0.12/src/toplevel.c:42:10:  [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).
  q=name+strlen(name);

ANALYSIS SUMMARY:

Hits = 68
Lines analyzed = 14462 in approximately 0.46 seconds (31508 lines/second)
Physical Source Lines of Code (SLOC) = 12100
Hits@level = [0] 300 [1]  24 [2]  29 [3]   3 [4]  12 [5]   0
Hits@level+ = [0+] 368 [1+]  68 [2+]  44 [3+]  15 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 30.4132 [1+] 5.61983 [2+] 3.63636 [3+] 1.23967 [4+] 0.991736 [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.