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/mscgen-0.20/src/lexer.c
Examining data/mscgen-0.20/src/language.h
Examining data/mscgen-0.20/src/cmdparse.h
Examining data/mscgen-0.20/src/lexer.h
Examining data/mscgen-0.20/src/ps_out.c
Examining data/mscgen-0.20/src/usage.h
Examining data/mscgen-0.20/src/msc.c
Examining data/mscgen-0.20/src/utf8.c
Examining data/mscgen-0.20/src/utf8.h
Examining data/mscgen-0.20/src/safe.c
Examining data/mscgen-0.20/src/null_out.c
Examining data/mscgen-0.20/src/svg_out.c
Examining data/mscgen-0.20/src/language.c
Examining data/mscgen-0.20/src/usage.c
Examining data/mscgen-0.20/src/adraw.h
Examining data/mscgen-0.20/src/safe.h
Examining data/mscgen-0.20/src/cmdparse.c
Examining data/mscgen-0.20/src/bool.h
Examining data/mscgen-0.20/src/main.c
Examining data/mscgen-0.20/src/msc.h
Examining data/mscgen-0.20/src/adraw_int.h
Examining data/mscgen-0.20/src/adraw.c
Examining data/mscgen-0.20/src/gd_out.c

FINAL RESULTS:

data/mscgen-0.20/src/cmdparse.c:138:20:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
                if(sscanf(argv[t], swt->parseString, swt->parseResult) != 1)
data/mscgen-0.20/src/cmdparse.c:162:20:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
                if(sscanf(opt, swt->parseString, swt->parseResult) != 1)
data/mscgen-0.20/src/language.c:1061: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/mscgen-0.20/src/main.c:1616:31:  [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 *envFont = getenv("MSCGEN_FONT");
data/mscgen-0.20/src/main.c:1641:25:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
    deleteTmpFilename = tempnam(NULL, "mscgen");
data/mscgen-0.20/src/safe.c:105:15:  [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.
    char *r = getenv(name);
data/mscgen-0.20/src/gd_out.c:553:28:  [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).
        context->outFile = fopen(file, "wb");
data/mscgen-0.20/src/language.c:1361: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
data/mscgen-0.20/src/language.c:1378: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 yyformat[sizeof yyunexpected
data/mscgen-0.20/src/language.c:1568: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/mscgen-0.20/src/main.c:146:8:  [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    gInputFile[4096];
data/mscgen-0.20/src/main.c:149:8:  [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    gOutputFile[4096];
data/mscgen-0.20/src/main.c:152:8:  [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    gOutType[10];
data/mscgen-0.20/src/main.c:159:8:  [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    gOutputFont[256];
data/mscgen-0.20/src/main.c:444:13:  [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(retLines[c], label, lineLen);
data/mscgen-0.20/src/main.c:553: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(out, lineStart, lineLen);
data/mscgen-0.20/src/main.c:750: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               lineBuffer[1024];
data/mscgen-0.20/src/main.c:1682:13:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
        h = mkstemp(tmpTemplate);
data/mscgen-0.20/src/main.c:1707: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).
        FILE *in = fopen(gInputFile, "r");
data/mscgen-0.20/src/main.c:1746:17:  [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).
        ismap = fopen(gOutputFile, "w");
data/mscgen-0.20/src/ps_out.c:517:23:  [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).
        context->of = fopen(file, "wb");
data/mscgen-0.20/src/svg_out.c:444: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.
    static char colCmd[10];
data/mscgen-0.20/src/svg_out.c:450:9:  [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(colCmd, "#%06X", col);
data/mscgen-0.20/src/svg_out.c:461: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.
    static char colCmd[10];
data/mscgen-0.20/src/svg_out.c:467:9:  [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(colCmd, "#%06X", col);
data/mscgen-0.20/src/svg_out.c:540:23:  [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).
        context->of = fopen(file, "wb");
data/mscgen-0.20/src/cmdparse.c:59:47:  [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(strncmp(opts[t].switchString, swt, strlen(opts[t].switchString)) == 0)
data/mscgen-0.20/src/cmdparse.c:159:28:  [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).
                    opt += strlen(swt->switchString);
data/mscgen-0.20/src/gd_out.c:185:28:  [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 unsigned int l = strlen(string);
data/mscgen-0.20/src/language.c:196:42:  [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(strncmp(tokNames[t], str, strlen(tokNames[t])) == 0)
data/mscgen-0.20/src/language.c:202: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).
                str += strlen(tokNames[t]);
data/mscgen-0.20/src/language.c:253: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).
    const uint16_t l = strlen(in);
data/mscgen-0.20/src/language.c:1242: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/mscgen-0.20/src/lexer.c:811: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/mscgen-0.20/src/lexer.c:2106:29:  [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,strlen(yystr) );
data/mscgen-0.20/src/main.c:226: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).
    int l = strlen(s);
data/mscgen-0.20/src/main.c:299: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).
    char *p = l + strlen(l);
data/mscgen-0.20/src/main.c:543: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).
        lineLen = strlen(string) - (lineStart - string);
data/mscgen-0.20/src/main.c:1609:9:  [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. Risk is low because the source is a
  constant character.
        strncat(gOutputFile, ".", sizeof(gOutputFile) - (strlen(gOutputFile) + 1));
data/mscgen-0.20/src/main.c:1609:58:  [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).
        strncat(gOutputFile, ".", sizeof(gOutputFile) - (strlen(gOutputFile) + 1));
data/mscgen-0.20/src/main.c:1610:9:  [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(gOutputFile, gOutType, sizeof(gOutputFile) - (strlen(gOutputFile) + 1));
data/mscgen-0.20/src/main.c:1610:63:  [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).
        strncat(gOutputFile, gOutType, sizeof(gOutputFile) - (strlen(gOutputFile) + 1));

ANALYSIS SUMMARY:

Hits = 42
Lines analyzed = 11323 in approximately 0.30 seconds (37992 lines/second)
Physical Source Lines of Code (SLOC) = 7249
Hits@level = [0] 119 [1]  16 [2]  20 [3]   3 [4]   3 [5]   0
Hits@level+ = [0+] 161 [1+]  42 [2+]  26 [3+]   6 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 22.21 [1+] 5.7939 [2+] 3.5867 [3+] 0.8277 [4+] 0.41385 [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.