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/nsnake-3.0.1/deps/commander/commander.c
Examining data/nsnake-3.0.1/deps/commander/commander.h
Examining data/nsnake-3.0.1/doc/doxygen_mainpage.hpp
Examining data/nsnake-3.0.1/src/Config/Arguments.cpp
Examining data/nsnake-3.0.1/src/Config/Arguments.hpp
Examining data/nsnake-3.0.1/src/Config/Globals.cpp
Examining data/nsnake-3.0.1/src/Config/Globals.hpp
Examining data/nsnake-3.0.1/src/Config/INI.cpp
Examining data/nsnake-3.0.1/src/Config/INI.hpp
Examining data/nsnake-3.0.1/src/Flow/GameState.hpp
Examining data/nsnake-3.0.1/src/Flow/GameStateGame.cpp
Examining data/nsnake-3.0.1/src/Flow/GameStateGame.hpp
Examining data/nsnake-3.0.1/src/Flow/GameStateMainMenu.cpp
Examining data/nsnake-3.0.1/src/Flow/GameStateMainMenu.hpp
Examining data/nsnake-3.0.1/src/Flow/InputManager.cpp
Examining data/nsnake-3.0.1/src/Flow/InputManager.hpp
Examining data/nsnake-3.0.1/src/Flow/StateManager.cpp
Examining data/nsnake-3.0.1/src/Flow/StateManager.hpp
Examining data/nsnake-3.0.1/src/Game/Board.cpp
Examining data/nsnake-3.0.1/src/Game/Board.hpp
Examining data/nsnake-3.0.1/src/Game/BoardParser.cpp
Examining data/nsnake-3.0.1/src/Game/BoardParser.hpp
Examining data/nsnake-3.0.1/src/Game/FruitManager.cpp
Examining data/nsnake-3.0.1/src/Game/FruitManager.hpp
Examining data/nsnake-3.0.1/src/Game/Game.cpp
Examining data/nsnake-3.0.1/src/Game/Game.hpp
Examining data/nsnake-3.0.1/src/Game/Player.cpp
Examining data/nsnake-3.0.1/src/Game/Player.hpp
Examining data/nsnake-3.0.1/src/Game/ScoreFile.cpp
Examining data/nsnake-3.0.1/src/Game/ScoreFile.hpp
Examining data/nsnake-3.0.1/src/Interface/Animation/Animation.hpp
Examining data/nsnake-3.0.1/src/Interface/Animation/AnimationSnakes.cpp
Examining data/nsnake-3.0.1/src/Interface/Animation/AnimationSnakes.hpp
Examining data/nsnake-3.0.1/src/Interface/Colors.cpp
Examining data/nsnake-3.0.1/src/Interface/Colors.hpp
Examining data/nsnake-3.0.1/src/Interface/Dialog.cpp
Examining data/nsnake-3.0.1/src/Interface/Dialog.hpp
Examining data/nsnake-3.0.1/src/Interface/Layout.cpp
Examining data/nsnake-3.0.1/src/Interface/Layout.hpp
Examining data/nsnake-3.0.1/src/Interface/LayoutFirstTime.cpp
Examining data/nsnake-3.0.1/src/Interface/LayoutFirstTime.hpp
Examining data/nsnake-3.0.1/src/Interface/LayoutGame.cpp
Examining data/nsnake-3.0.1/src/Interface/LayoutGame.hpp
Examining data/nsnake-3.0.1/src/Interface/LayoutMainMenu.cpp
Examining data/nsnake-3.0.1/src/Interface/LayoutMainMenu.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/Menu.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/Menu.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuAlphabetic.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuAlphabetic.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItem.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItem.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemCheckbox.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemCheckbox.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemLabel.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemLabel.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemNumberbox.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemNumberbox.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemTextbox.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemTextbox.hpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemTextlist.cpp
Examining data/nsnake-3.0.1/src/Interface/Menu/MenuItemTextlist.hpp
Examining data/nsnake-3.0.1/src/Interface/Ncurses.cpp
Examining data/nsnake-3.0.1/src/Interface/Ncurses.hpp
Examining data/nsnake-3.0.1/src/Interface/Window.cpp
Examining data/nsnake-3.0.1/src/Interface/Window.hpp
Examining data/nsnake-3.0.1/src/Interface/WindowGameHelp.cpp
Examining data/nsnake-3.0.1/src/Interface/WindowGameHelp.hpp
Examining data/nsnake-3.0.1/src/Misc/Array2D.hpp
Examining data/nsnake-3.0.1/src/Misc/Timer.cpp
Examining data/nsnake-3.0.1/src/Misc/Timer.hpp
Examining data/nsnake-3.0.1/src/Misc/Utils.cpp
Examining data/nsnake-3.0.1/src/Misc/Utils.hpp
Examining data/nsnake-3.0.1/src/main.cpp

FINAL RESULTS:

data/nsnake-3.0.1/deps/commander/commander.c:110:5:  [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(nargv[size], arg);
data/nsnake-3.0.1/src/Misc/Utils.cpp:150:2:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
	system(command.c_str());
data/nsnake-3.0.1/src/Misc/Utils.cpp:161:2:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
	system(command.c_str());
data/nsnake-3.0.1/src/Misc/Utils.cpp:45:2:  [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(time(NULL));
data/nsnake-3.0.1/src/Misc/Utils.cpp:237:8:  [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("HOME"))
data/nsnake-3.0.1/src/Misc/Utils.cpp:240:16:  [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.
	std::string s(getenv("HOME"));
data/nsnake-3.0.1/deps/commander/commander.c:102: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(nargv[size], "-%c", arg[j]);
data/nsnake-3.0.1/deps/commander/commander.h:73: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 *argv[COMMANDER_MAX_ARGS];
data/nsnake-3.0.1/src/Config/Globals.hpp:52: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.
	extern char version[3];
data/nsnake-3.0.1/src/Flow/InputManager.cpp:66:4:  [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 c[2] = { (char)value, '\0' };
data/nsnake-3.0.1/src/Game/ScoreFile.cpp:118:7:  [2] (misc) open:
  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.open(score_file.c_str());
data/nsnake-3.0.1/src/Game/ScoreFile.cpp:259:7:  [2] (misc) open:
  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.open(score_file.c_str());
data/nsnake-3.0.1/src/Interface/Colors.cpp:98: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 col[3];
data/nsnake-3.0.1/src/Misc/Utils.cpp:166: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).
	FILE* fp = fopen(path.c_str(), "w");
data/nsnake-3.0.1/src/Misc/Utils.cpp:176:7:  [2] (misc) open:
  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.open(path.c_str()); // if it was C++11 we could've used std::string
data/nsnake-3.0.1/src/Misc/Utils.cpp:449:11:  [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.
	unsigned char char_array_3[3];
data/nsnake-3.0.1/src/Misc/Utils.cpp:450:11:  [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.
	unsigned char char_array_4[4];
data/nsnake-3.0.1/src/Misc/Utils.cpp:494:11:  [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.
	unsigned char char_array_4[4], char_array_3[3];
data/nsnake-3.0.1/deps/commander/commander.c:61:16:  [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 len = strlen(str);
data/nsnake-3.0.1/deps/commander/commander.c:93: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).
    size_t len = strlen(arg);
data/nsnake-3.0.1/deps/commander/commander.c:132: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).
  option->argname = malloc(strlen(large) + 1);
data/nsnake-3.0.1/deps/commander/commander.c:134: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).
  option->large = malloc(strlen(large) + 1);
data/nsnake-3.0.1/src/Misc/Utils.cpp:77:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep((useconds_t)delay * 100);

ANALYSIS SUMMARY:

Hits = 23
Lines analyzed = 8952 in approximately 0.18 seconds (50043 lines/second)
Physical Source Lines of Code (SLOC) = 5673
Hits@level = [0]   3 [1]   5 [2]  12 [3]   3 [4]   3 [5]   0
Hits@level+ = [0+]  26 [1+]  23 [2+]  18 [3+]   6 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 4.58311 [1+] 4.05429 [2+] 3.17292 [3+] 1.05764 [4+] 0.528821 [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.