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/mousetrap-1.0c/src/enemy.cpp
Examining data/mousetrap-1.0c/src/highscore.cpp
Examining data/mousetrap-1.0c/src/highscore.h
Examining data/mousetrap-1.0c/src/enemy.h
Examining data/mousetrap-1.0c/src/soundeffects.cpp
Examining data/mousetrap-1.0c/src/font.cpp
Examining data/mousetrap-1.0c/src/font.h
Examining data/mousetrap-1.0c/src/soundeffects.h
Examining data/mousetrap-1.0c/src/mousetrap.h
Examining data/mousetrap-1.0c/src/mousetrap.cpp

FINAL RESULTS:

data/mousetrap-1.0c/src/font.cpp:51:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(tempString,"%s/%s",fontdir,"font.ini");
data/mousetrap-1.0c/src/font.cpp:67:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(tempString,"%s/%s",fontdir,"font.raw");
data/mousetrap-1.0c/src/font.cpp:105:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(tempString,"%s/%s",fontdir,"font.dat");
data/mousetrap-1.0c/src/font.cpp:128:3:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
  vsprintf(string, str, ap);          // And Converts Symbols To Actual Numbers
data/mousetrap-1.0c/src/font.cpp:205:3:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
  vsprintf(string, str, ap);          // And Converts Symbols To Actual Numbers
data/mousetrap-1.0c/src/highscore.cpp:111:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    int i = access ( f_path, F_OK );
data/mousetrap-1.0c/src/mousetrap.cpp:107:9:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    i = access ( path, F_OK );
data/mousetrap-1.0c/src/mousetrap.cpp:120:6:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	i = access( f_path, F_OK );
data/mousetrap-1.0c/src/mousetrap.cpp:380:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(path_font, "%s/%s/data/font1", DEFAULT_LIBDIR, PACKAGE);
data/mousetrap-1.0c/src/soundeffects.cpp:130:9:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    i = access ( path, F_OK );
data/mousetrap-1.0c/src/soundeffects.cpp:139:6:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	i = access ( f_path, F_OK );
data/mousetrap-1.0c/src/highscore.cpp:106:54:  [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.
    snprintf(f_path, sizeof(f_path), "%s/.mousetrap",getenv( "HOME" ));
data/mousetrap-1.0c/src/highscore.cpp:143:54:  [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.
    snprintf(f_path, sizeof(f_path), "%s/.mousetrap",getenv( "HOME" ));
data/mousetrap-1.0c/src/mousetrap.cpp:346:5:  [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.
    srand( (unsigned)time( NULL ) );
data/mousetrap-1.0c/src/font.cpp:45: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 tempString[100];            // temporary string
data/mousetrap-1.0c/src/font.cpp:52:8:  [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(tempString, "rb");
data/mousetrap-1.0c/src/font.cpp:68:8:  [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(tempString, "rb");
data/mousetrap-1.0c/src/font.cpp:106:8:  [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(tempString, "rb");
data/mousetrap-1.0c/src/font.cpp:124: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 string[1024];                  // Temporary string
data/mousetrap-1.0c/src/font.cpp:201: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 string[1024];                  // Temporary string
data/mousetrap-1.0c/src/highscore.cpp:105: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 f_path[1025];
data/mousetrap-1.0c/src/highscore.cpp:114: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 line[1025];
data/mousetrap-1.0c/src/highscore.cpp:117:6:  [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).
	f = fopen( f_path, "r" );
data/mousetrap-1.0c/src/highscore.cpp:142: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 f_path[1025];
data/mousetrap-1.0c/src/highscore.cpp:145: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).
    FILE *f = fopen( f_path, "w" );
data/mousetrap-1.0c/src/mousetrap.cpp:104: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 f_path[1025];
data/mousetrap-1.0c/src/mousetrap.cpp:210: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 scoreMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:218: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 livesMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:224: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 shieldMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:232: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 highscoreMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:260:6:  [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 scoreMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:269:6:  [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 highscoreMsg[20];
data/mousetrap-1.0c/src/mousetrap.cpp:379: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 path_font[100];
data/mousetrap-1.0c/src/soundeffects.cpp:127: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 f_path[1024];
data/mousetrap-1.0c/src/font.cpp:73:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      tmp = fgetc(fp);
data/mousetrap-1.0c/src/font.cpp:111:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      tmp = fgetc(fp);
data/mousetrap-1.0c/src/font.cpp:131: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).
  int len=strlen(string);             // Get the number of chars in the string
data/mousetrap-1.0c/src/font.cpp:210: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).
  int len=strlen(string);

ANALYSIS SUMMARY:

Hits = 38
Lines analyzed = 2151 in approximately 0.05 seconds (40494 lines/second)
Physical Source Lines of Code (SLOC) = 899
Hits@level = [0]  23 [1]   4 [2]  20 [3]   3 [4]  11 [5]   0
Hits@level+ = [0+]  61 [1+]  38 [2+]  34 [3+]  14 [4+]  11 [5+]   0
Hits/KSLOC@level+ = [0+] 67.8532 [1+] 42.2692 [2+] 37.8198 [3+] 15.5729 [4+] 12.2358 [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.