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/grap-1.45/grap_draw.cc
Examining data/grap-1.45/grap_pic.cc
Examining data/grap-1.45/grap_parse.cc
Examining data/grap-1.45/grap_tokenizer.cc
Examining data/grap-1.45/strdup.cc
Examining data/grap-1.45/strerror.cc
Examining data/grap-1.45/grap.h
Examining data/grap-1.45/grap_data.h
Examining data/grap-1.45/grap_draw.h
Examining data/grap-1.45/grap_pic.h
Examining data/grap-1.45/grap_string.h
Examining data/grap-1.45/snprintf.h

FINAL RESULTS:

data/grap-1.45/grap.h:14:11:  [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).
    char *strcpy(char *, const char *);
data/grap-1.45/grap.h:17:11:  [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).
    char *strcat(char *, const char *);
data/grap-1.45/grap.h:29:9:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    int snprintf(char *, size_t, const char *, ...);
data/grap-1.45/grap_draw.h:197:2:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	snprintf(c,64,fmt->c_str(),e);
data/grap-1.45/grap_string.h:17:2:  [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(str,c);
data/grap-1.45/grap_string.h:28:13:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	if ( fmt ) snprintf(str,len,fmt->str,d);
data/grap-1.45/grap_string.h:35:6:  [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(str,x->str);
data/grap-1.45/grap_string.h:41:6:  [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(str,x.str);
data/grap-1.45/grap_string.h:62:12:  [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).
	if ( len )strcpy(str,s.str);
data/grap-1.45/grap_string.h:69:13:  [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).
	if ( len ) strcat(str,s.str);
data/grap-1.45/grap_string.h:77:13:  [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).
	if ( len ) strcat(str,s);
data/grap-1.45/grap_string.h:114:6:  [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(str+start,str+end);
data/grap-1.45/snprintf.h:14:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt) {
data/grap-1.45/snprintf.h:21:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt);
data/grap-1.45/snprintf.h:24:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt)) > lim ) {
data/grap-1.45/snprintf.h:33:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d) {
data/grap-1.45/snprintf.h:40:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d);
data/grap-1.45/snprintf.h:43:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d)) > lim ) {
data/grap-1.45/snprintf.h:52:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2) {
data/grap-1.45/snprintf.h:59:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2);
data/grap-1.45/snprintf.h:62:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2)) > lim ) {
data/grap-1.45/snprintf.h:70:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:78:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3);
data/grap-1.45/snprintf.h:81:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3)) > lim ) {
data/grap-1.45/snprintf.h:89:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:97:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4);
data/grap-1.45/snprintf.h:100:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4)) > lim ) {
data/grap-1.45/snprintf.h:108:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:116:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5);
data/grap-1.45/snprintf.h:119:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5)) > lim ) {
data/grap-1.45/snprintf.h:127:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:135:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5, d6);
data/grap-1.45/snprintf.h:138:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5, d6)) > lim ) {
data/grap-1.45/snprintf.h:146:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:154:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7);
data/grap-1.45/snprintf.h:157:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7)) > lim ) {
data/grap-1.45/snprintf.h:165:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:173:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8);
data/grap-1.45/snprintf.h:176:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8)) > lim ) {
data/grap-1.45/snprintf.h:184:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:193:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8, d9);
data/grap-1.45/snprintf.h:196:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8, d9)) > lim ) {
data/grap-1.45/snprintf.h:204:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
inline int snprintf(char *s, int lim, const char *fmt, double d1, double d2,
data/grap-1.45/snprintf.h:213:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8, d9, d10);
data/grap-1.45/snprintf.h:216:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    if ( (tot = sprintf(s,fmt,d1, d2, d3, d4, d5, d6, d7, d8, d9, d10)) 
data/grap-1.45/grap.h:203:10:  [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.
    long random();
data/grap-1.45/grap.h:204:10:  [3] (random) srandom:
  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 srandom(unsigned long);
data/grap-1.45/grap.h:209:9:  [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.
#define random rand
data/grap-1.45/grap.h:210:9:  [3] (random) srandom:
  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.
#define srandom srand
data/grap-1.45/grap.h:210:17:  [3] (random) srand:
  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.
#define srandom srand
data/grap-1.45/grap.h:214:10:  [3] (random) srand:
  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 srand(unsigned);
data/grap-1.45/grap_parse.cc:21:9:  [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.
    int getopt(int, char * const [], const char *);
data/grap-1.45/grap_parse.cc:900:9:  [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 (getenv("GRAP_DEFINES"))
data/grap-1.45/grap_parse.cc:901:12:  [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.
	defines = getenv("GRAP_DEFINES");
data/grap-1.45/grap_parse.cc:902:10:  [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 ( getenv("GRAP_SAFER") )
data/grap-1.45/grap_parse.cc:914:19:  [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,opts)) != -1)
data/grap-1.45/strerror.cc:4: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 rv[100];
data/grap-1.45/strerror.cc:6: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(rv, "error number %d", errnum);
data/grap-1.45/grap.h:13:12:  [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).
    size_t strlen(const char*);
data/grap-1.45/grap.h:18:11:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    char *strncpy(char *, const char *, const size_t);
data/grap-1.45/grap_string.h:16:11:  [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).
	resize(::strlen(c)+1);
data/grap-1.45/grap_string.h:67: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).
	int nlen = s.strlen() + strlen()+ 1;
data/grap-1.45/grap_string.h:67:26:  [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 nlen = s.strlen() + strlen()+ 1;
data/grap-1.45/grap_string.h:74: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).
	int nlen = ::strlen(s) + strlen() + 1;
data/grap-1.45/grap_string.h:74: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).
	int nlen = ::strlen(s) + strlen() + 1;
data/grap-1.45/grap_string.h:82: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 last = strlen();
data/grap-1.45/grap_string.h:85: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).
	last=strlen();
data/grap-1.45/grap_string.h:145: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).
	if ( len < strlen()+3 ) resize(len+3);
data/grap-1.45/grap_string.h:148:6:  [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).
	l = strlen();
data/grap-1.45/grap_string.h:157: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).
	    str[strlen()-1] = '\0';
data/grap-1.45/grap_string.h:160:6:  [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 = strlen();
data/grap-1.45/grap_string.h:164:10:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    void strncpy(char *s, int l) {
data/grap-1.45/grap_string.h:165:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	::strncpy(s,str,l);
data/grap-1.45/grap_string.h:168: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).
    int strlen() const {
data/grap-1.45/grap_string.h:169: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).
	return ( (str) ? ::strlen(str) : 0 );
data/grap-1.45/grap_string.h:172:33:  [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 length() const { return strlen();}
data/grap-1.45/grap_string.h:181:11:  [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).
	s.resize(strlen());
data/grap-1.45/grap_string.h:182: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).
	if ( n == 0 || n > strlen()-i )
data/grap-1.45/grap_string.h:183: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).
	    n = strlen() - i;
data/grap-1.45/strdup.cc:10: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).
    int len = strlen(s)+1;

ANALYSIS SUMMARY:

Hits = 80
Lines analyzed = 4223 in approximately 0.14 seconds (31078 lines/second)
Physical Source Lines of Code (SLOC) = 3231
Hits@level = [0]   2 [1]  22 [2]   2 [3]  11 [4]  45 [5]   0
Hits@level+ = [0+]  82 [1+]  80 [2+]  58 [3+]  56 [4+]  45 [5+]   0
Hits/KSLOC@level+ = [0+] 25.3791 [1+] 24.7601 [2+] 17.9511 [3+] 17.3321 [4+] 13.9276 [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.