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/grhino-0.16.1/board.cc
Examining data/grhino-0.16.1/load.cc
Examining data/grhino-0.16.1/gen_pattern.cc
Examining data/grhino-0.16.1/gen_opening.cc
Examining data/grhino-0.16.1/pattern.cc
Examining data/grhino-0.16.1/bitboard.cc
Examining data/grhino-0.16.1/gtp.cc
Examining data/grhino-0.16.1/hash.cc
Examining data/grhino-0.16.1/hash.h
Examining data/grhino-0.16.1/proginfo.h
Examining data/grhino-0.16.1/iter.h
Examining data/grhino-0.16.1/randboard.h
Examining data/grhino-0.16.1/gtstream.cc
Examining data/grhino-0.16.1/gpref.cc
Examining data/grhino-0.16.1/gameinfo.cc
Examining data/grhino-0.16.1/gevalwin.cc
Examining data/grhino-0.16.1/ggamewin.h
Examining data/grhino-0.16.1/game.cc
Examining data/grhino-0.16.1/randboard.cc
Examining data/grhino-0.16.1/pattern.h
Examining data/grhino-0.16.1/rand.h
Examining data/grhino-0.16.1/gtstream.h
Examining data/grhino-0.16.1/binfile.h
Examining data/grhino-0.16.1/binfile.cc
Examining data/grhino-0.16.1/gpref.h
Examining data/grhino-0.16.1/parity.cc
Examining data/grhino-0.16.1/ghistwin.cc
Examining data/grhino-0.16.1/parity.h
Examining data/grhino-0.16.1/gtp.h
Examining data/grhino-0.16.1/fdstream.h
Examining data/grhino-0.16.1/book.cc
Examining data/grhino-0.16.1/bitboard.h
Examining data/grhino-0.16.1/alphabeta.cc
Examining data/grhino-0.16.1/rand.cc
Examining data/grhino-0.16.1/log_proc.h
Examining data/grhino-0.16.1/board.h
Examining data/grhino-0.16.1/opening.cc
Examining data/grhino-0.16.1/proginfo.cc
Examining data/grhino-0.16.1/order.cc
Examining data/grhino-0.16.1/table-dat.h
Examining data/grhino-0.16.1/gen_book.cc
Examining data/grhino-0.16.1/test.cc
Examining data/grhino-0.16.1/iter.cc
Examining data/grhino-0.16.1/gutil.h
Examining data/grhino-0.16.1/grhino.cc
Examining data/grhino-0.16.1/ghistwin.h
Examining data/grhino-0.16.1/boardio.cc
Examining data/grhino-0.16.1/game.h
Examining data/grhino-0.16.1/gevalwin.h
Examining data/grhino-0.16.1/load.h
Examining data/grhino-0.16.1/gen_table.cc
Examining data/grhino-0.16.1/aiai.cc
Examining data/grhino-0.16.1/boardio.h
Examining data/grhino-0.16.1/gameinfo.h
Examining data/grhino-0.16.1/book.h
Examining data/grhino-0.16.1/alphabeta.h
Examining data/grhino-0.16.1/opening-dat.h
Examining data/grhino-0.16.1/dump_pattern.cc
Examining data/grhino-0.16.1/gtp-rhino.cc
Examining data/grhino-0.16.1/order.h
Examining data/grhino-0.16.1/ggamewin.cc
Examining data/grhino-0.16.1/opening.h
Examining data/grhino-0.16.1/gutil.cc

FINAL RESULTS:

data/grhino-0.16.1/aiai.cc:212:7:  [4] (shell) execlp:
  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.
		if (execlp("/bin/sh", "sh", "-c", cmd_black, 0) == -1)
data/grhino-0.16.1/aiai.cc:232:7:  [4] (shell) execlp:
  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.
		if (execlp("/bin/sh", "sh", "-c", cmd_white, 0) == -1)
data/grhino-0.16.1/aiai.cc:111: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/grhino-0.16.1/game.cc:347: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 *env = getenv("HOME");
data/grhino-0.16.1/ggamewin.cc:81:31:  [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.
		if (res->vec->operator[](i).random) {
data/grhino-0.16.1/grhino.cc:895: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/grhino-0.16.1/gtp-rhino.cc:704: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/grhino-0.16.1/load.cc:102:11:  [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.
	if (game.random)
data/grhino-0.16.1/load.h:31:8:  [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.
	bool		random;
data/grhino-0.16.1/load.h:33:50:  [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.
	game_library_log(int b, int w): game_log(b, w), random(false) {}
data/grhino-0.16.1/log_proc.h:238:7:  [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.
		if (random)
data/grhino-0.16.1/aiai.cc:510: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 buffer[80];
data/grhino-0.16.1/aiai.cc:543: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 buffer[80];
data/grhino-0.16.1/binfile.cc:51:11:  [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).
	handle = open(f.c_str(), O_RDONLY);
data/grhino-0.16.1/binfile.cc:147: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	buf[16];
data/grhino-0.16.1/binfile.cc:259: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	buf[16];
data/grhino-0.16.1/binfile.h:38: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.
		unsigned char	buffer[max_buffer_size];
data/grhino-0.16.1/binfile.h:65: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.
		unsigned char	buffer[max_buffer_size];
data/grhino-0.16.1/bitboard.cc:57:2:  [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(&board, board_init, sizeof(board_type));
data/grhino-0.16.1/bitboard.cc:66:2:  [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(board, board_init, sizeof(bit_board_type));
data/grhino-0.16.1/bitboard.cc:80:2:  [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(this, &src, sizeof(bit_board_info));
data/grhino-0.16.1/board.cc:105:2:  [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(board, board_init, sizeof(byte_board_type));
data/grhino-0.16.1/board.cc:121:2:  [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(this, &src, sizeof(byte_board_info));
data/grhino-0.16.1/dump_pattern.cc:125:15:  [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).
	int handle = open(get_pattern_file(pattern), O_RDONLY);
data/grhino-0.16.1/game.cc:116: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.
const char *game_mode_name[NUM_GAME_MODE] = {
data/grhino-0.16.1/game.cc:133: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.
const char *level_name[NUM_LEVEL_INFO+1] = {
data/grhino-0.16.1/game.cc:138: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.
const char *opening_var_name[NUM_OPENING_VAR] = {
data/grhino-0.16.1/game.cc:154: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.
const char *start_game_mode_name[NUM_START_GAME_MODE] = {
data/grhino-0.16.1/game.cc:481: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 buffer[80];
data/grhino-0.16.1/game.cc:599: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).
		h = open(file1.c_str(), O_CREAT | O_EXCL, S_IRWXU);
data/grhino-0.16.1/game.h:81:14:  [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 const char *game_mode_name[NUM_GAME_MODE];
data/grhino-0.16.1/game.h:98:14:  [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 const char *level_name[NUM_LEVEL_INFO+1];
data/grhino-0.16.1/game.h:102:14:  [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 const char *opening_var_name[NUM_OPENING_VAR];
data/grhino-0.16.1/game.h:121:14:  [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 const char *start_game_mode_name[NUM_START_GAME_MODE];
data/grhino-0.16.1/gen_pattern.cc:341:15:  [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).
	int handle = open(get_pattern_file(p), O_RDONLY);
data/grhino-0.16.1/ggamewin.cc:73: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 buf1[20], buf2[20], buf3[50];
data/grhino-0.16.1/gpref.cc:68: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.
const char *toolbar_icon_name[NUM_TOOLBAR_ICON_SIZE] = {
data/grhino-0.16.1/pattern.cc:48: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.
const char row1_pattern[4][8] = {
data/grhino-0.16.1/pattern.cc:55: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.
const char row2_pattern[4][8] = {
data/grhino-0.16.1/pattern.cc:62: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.
const char row3_pattern[4][8] = {
data/grhino-0.16.1/pattern.cc:69: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.
const char row4_pattern[4][8] = {
data/grhino-0.16.1/pattern.cc:76: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.
const char diag1_pattern[2][8] = {
data/grhino-0.16.1/pattern.cc:81: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.
const char diag2_pattern[4][7] = {
data/grhino-0.16.1/pattern.cc:88: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.
const char diag3_pattern[4][6] = {
data/grhino-0.16.1/pattern.cc:95: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.
const char diag4_pattern[4][5] = {
data/grhino-0.16.1/pattern.cc:102: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.
const char diag5_pattern[4][4] = {
data/grhino-0.16.1/pattern.cc:109: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.
const char edge_x_pattern[4][10] = {
data/grhino-0.16.1/pattern.cc:116: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.
const char corner5x2_pattern[8][10] = {
data/grhino-0.16.1/pattern.cc:220:15:  [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).
	int handle = open(get_pattern_data_file(p), O_RDONLY);
data/grhino-0.16.1/pattern.h:43: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.
	const char	*pattern[max_num_pattern];
data/grhino-0.16.1/table-dat.h:3: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 bit_count_table[256] = {
data/grhino-0.16.1/aiai.cc:126:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(h, &c, 1) != 1)
data/grhino-0.16.1/aiai.cc:149:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(h, &c, 1) != 1)
data/grhino-0.16.1/aiai.cc:242: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).
	      gtpcmd_boardsize, strlen(gtpcmd_boardsize));
data/grhino-0.16.1/aiai.cc:244: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).
	      gtpcmd_boardsize, strlen(gtpcmd_boardsize));
data/grhino-0.16.1/aiai.cc:251:46:  [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).
	write(fifo_black_to_client[1], gtpcmd_quit, strlen(gtpcmd_quit));
data/grhino-0.16.1/aiai.cc:252:46:  [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).
	write(fifo_white_to_client[1], gtpcmd_quit, strlen(gtpcmd_quit));
data/grhino-0.16.1/aiai.cc:281: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).
		      gtpcmd_clear_board, strlen(gtpcmd_clear_board));
data/grhino-0.16.1/aiai.cc:283: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).
		      gtpcmd_clear_board, strlen(gtpcmd_clear_board));
data/grhino-0.16.1/aiai.cc:319:32:  [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).
			      gtpcmd_genmove_black, strlen(gtpcmd_genmove_black));
data/grhino-0.16.1/aiai.cc:334:32:  [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).
			      gtpcmd_genmove_white, strlen(gtpcmd_genmove_white));
data/grhino-0.16.1/binfile.cc:85:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int	size_read = read(handle, buffer+size_in_buffer, size_to_read);
data/grhino-0.16.1/dump_pattern.cc:146:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(handle, pat, size) != size) {
data/grhino-0.16.1/game.cc:621:3:  [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(100);		// Wait 0.1 sec
data/grhino-0.16.1/gen_pattern.cc:358:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(handle, pat[p][pos], io_size) != io_size) {
data/grhino-0.16.1/pattern.cc:229:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(handle, pattern_table[p][i], comp_size) != comp_size) {

ANALYSIS SUMMARY:

Hits = 66
Lines analyzed = 15373 in approximately 0.43 seconds (35965 lines/second)
Physical Source Lines of Code (SLOC) = 11388
Hits@level = [0]   9 [1]  15 [2]  40 [3]   9 [4]   2 [5]   0
Hits@level+ = [0+]  75 [1+]  66 [2+]  51 [3+]  11 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 6.58588 [1+] 5.79557 [2+] 4.4784 [3+] 0.965929 [4+] 0.175623 [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.