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/sgf2dg-4.252/sgf2mpost/sgf2mpost.c
Examining data/sgf2dg-4.252/sgfsplit.c

FINAL RESULTS:

data/sgf2dg-4.252/sgfsplit.c:146:3:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
  chmod(bname,PERMISSIONS);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:174: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(fontstring, DEFAULT_FONT);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:175: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(italfontstring, ITALIC_FONT);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:176: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(bignumberstring, BIGNUMBER_FONT);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:198:7:  [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(fontstring, optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:202:7:  [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(italfontstring, optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:206:7:  [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(bignumberstring, optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:234: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, HELP);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:283: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, HELP);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:290: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, HELP);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:452:4:  [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(outfile, PROLOG, VERSION);
data/sgf2dg-4.252/sgfsplit.c:119:5:  [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).
    strcat(extra_args,name);
data/sgf2dg-4.252/sgfsplit.c:134:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(bname,"%s.sgf2dg",name);
data/sgf2dg-4.252/sgfsplit.c:242:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(oname,"%s.%d.sgf",name,filecount++);
data/sgf2dg-4.252/sgfsplit.c:261:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
      sprintf(oname,"%s.%d.sgf",name,filecount++);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:178:15:  [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, "b:B:de:F:hi:I:l:L:n:o:r:s:S:t:T:v")) != -1)
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:75:1:  [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 fontstring[16];
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:76:1:  [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 italfontstring[16];
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:77:1:  [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 bignumberstring[16];
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:210:20:  [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).
      new_number = atoi(optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:214:21:  [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).
      left_column = atoi(optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:218:22:  [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).
      right_column = atoi(optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:222:20:  [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).
      bottom_row = atoi(optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:226:17:  [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).
      top_row = atoi(optarg);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:249:20:  [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).
	li = board_size - atoi(labelstring+1);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:262:20:  [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).
	li = board_size - atoi(labelstring+1);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:297: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).
    mpfile = fopen(outfilename, "w");
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:303: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).
  sgffile = fopen(infilename, "r");
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:362:14:  [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).
      from = atoi(fromstr);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:370:29:  [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).
      from_m = board_size - atoi(fromstr+1);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:377:15:  [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).
      until = atoi(untilstr);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:384:29:  [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).
      untilm = board_size - atoi(untilstr+1);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:768: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 mx[MAX_BOARD][MAX_BOARD];
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:852:2:  [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 movename[4];
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:868:4:  [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(movename + 1, "%d", board_size - m);
data/sgf2dg-4.252/sgfsplit.c:82:1:  [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 sgf[MAXSIZE],sgfout[MAXSIZE];
data/sgf2dg-4.252/sgfsplit.c:83:1:  [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 name[128],oname[128],bname[128],extra_args[128];
data/sgf2dg-4.252/sgfsplit.c:122: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).
  if (((fp=fopen(name,"r"))==NULL) &&
data/sgf2dg-4.252/sgfsplit.c:123: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).
      ((fp=fopen(strcat(name,".sgf"),"r"))==NULL)) {
data/sgf2dg-4.252/sgfsplit.c:123:18:  [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.
      ((fp=fopen(strcat(name,".sgf"),"r"))==NULL)) {
data/sgf2dg-4.252/sgfsplit.c:135:11:  [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 ((bp=fopen(bname,"w"))==NULL) {
data/sgf2dg-4.252/sgfsplit.c:185: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 oname[128];
data/sgf2dg-4.252/sgfsplit.c:243: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).
    if((fp=fopen(oname,"w"))==NULL) {
data/sgf2dg-4.252/sgfsplit.c:262: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((fp=fopen(oname,"w"))==NULL) {
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:390:15:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((c = getc(input)) != EOF) {
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:426:6:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	n = getc(input)-'a';
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:427:6:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	m = getc(input)-'a';
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:428:2:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	getc(input);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:622:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if ((c = getc(input)) != '[') {
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:626:6:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	n = getc(input)-'0'; /* handicap game */
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:635:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if ((c = getc(input)) != '[') {
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:639:6:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	n = getc(input)-'0';
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:641:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	  n = 10 + getc(input)-'0';
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:684:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      m = getc(input)-'a';
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:688:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      c = getc(input);
data/sgf2dg-4.252/sgf2mpost/sgf2mpost.c:689:11:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      c = getc(input);
data/sgf2dg-4.252/sgfsplit.c:120:5:  [1] (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 character.
    strcat(extra_args," ");
data/sgf2dg-4.252/sgfsplit.c:127:20:  [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 (!strcmp(name+strlen(name)-4,".sgf")) name[strlen(name)-4]='\0';
data/sgf2dg-4.252/sgfsplit.c:127:49:  [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 (!strcmp(name+strlen(name)-4,".sgf")) name[strlen(name)-4]='\0';
data/sgf2dg-4.252/sgfsplit.c:129:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((c=getc(fp))!=EOF) sgf[i++]=c;

ANALYSIS SUMMARY:

Hits = 60
Lines analyzed = 1232 in approximately 0.06 seconds (19859 lines/second)
Physical Source Lines of Code (SLOC) = 892
Hits@level = [0]  69 [1]  16 [2]  28 [3]   1 [4]  14 [5]   1
Hits@level+ = [0+] 129 [1+]  60 [2+]  44 [3+]  16 [4+]  15 [5+]   1
Hits/KSLOC@level+ = [0+] 144.619 [1+] 67.2646 [2+] 49.3274 [3+] 17.9372 [4+] 16.8161 [5+] 1.12108
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.