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/cwiid-0.6.91/libcwiid/process.c
Examining data/cwiid-0.6.91/libcwiid/cwiid.h
Examining data/cwiid-0.6.91/libcwiid/util.c
Examining data/cwiid-0.6.91/libcwiid/command.c
Examining data/cwiid-0.6.91/libcwiid/interface.c
Examining data/cwiid-0.6.91/libcwiid/cwiid_internal.h
Examining data/cwiid-0.6.91/libcwiid/bluetooth.c
Examining data/cwiid-0.6.91/libcwiid/thread.c
Examining data/cwiid-0.6.91/libcwiid/connect.c
Examining data/cwiid-0.6.91/libcwiid/state.c
Examining data/cwiid-0.6.91/python/Wiimote.c
Examining data/cwiid-0.6.91/python/cwiidmodule.c
Examining data/cwiid-0.6.91/wminput/util.h
Examining data/cwiid-0.6.91/wminput/c_plugin.c
Examining data/cwiid-0.6.91/wminput/conf.h
Examining data/cwiid-0.6.91/wminput/py_plugin.c
Examining data/cwiid-0.6.91/wminput/c_plugin.h
Examining data/cwiid-0.6.91/wminput/main.c
Examining data/cwiid-0.6.91/wminput/uinput.c
Examining data/cwiid-0.6.91/wminput/py_plugin.h
Examining data/cwiid-0.6.91/wminput/wmplugin.h
Examining data/cwiid-0.6.91/wminput/util.c
Examining data/cwiid-0.6.91/wminput/plugins/nunchuk_acc/nunchuk_acc.c
Examining data/cwiid-0.6.91/wminput/plugins/acc/acc.c
Examining data/cwiid-0.6.91/wminput/plugins/led/led.c
Examining data/cwiid-0.6.91/wminput/plugins/nunchuk_stick2btn/nunchuk_stick2btn.c
Examining data/cwiid-0.6.91/wminput/plugins/ir_ptr/ir_ptr.c
Examining data/cwiid-0.6.91/wminput/plugins/ir_fps/ir_fps.c
Examining data/cwiid-0.6.91/wminput/plugins/nunchuk_kb/nunchuk_kb.c
Examining data/cwiid-0.6.91/wminput/conf.c
Examining data/cwiid-0.6.91/wmgui/interface.h
Examining data/cwiid-0.6.91/wmgui/callbacks.h
Examining data/cwiid-0.6.91/wmgui/main.c
Examining data/cwiid-0.6.91/wmgui/support.c
Examining data/cwiid-0.6.91/wmgui/callbacks.c
Examining data/cwiid-0.6.91/wmgui/interface.c
Examining data/cwiid-0.6.91/wmgui/support.h
Examining data/cwiid-0.6.91/lswm/lswm.c
Examining data/cwiid-0.6.91/wmdemo/wmdemo.c

FINAL RESULTS:

data/cwiid-0.6.91/libcwiid/util.c:76:2:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	vfprintf(stderr, str, ap);
data/cwiid-0.6.91/wmdemo/wmdemo.c:51:2:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	vprintf(s, ap);
data/cwiid-0.6.91/wmgui/main.c:226:4:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			printf(USAGE, argv[0]);
data/cwiid-0.6.91/wmgui/main.c:247:4:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			printf(USAGE, argv[0]);
data/cwiid-0.6.91/wminput/c_plugin.c:179:2:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	vfprintf(stderr, str, ap);
data/cwiid-0.6.91/wminput/conf.c:544: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(conf->config_filename_stack[conf->stack_index], stackname);
data/cwiid-0.6.91/wminput/main.c:125:3:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		vfprintf(stderr, str, ap);
data/cwiid-0.6.91/wminput/util.c:35:2:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	vfprintf(stderr, str, ap);
data/cwiid-0.6.91/lswm/lswm.c:83:7:  [3] (buffer) getopt_long:
  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.
		c = getopt_long(argc, argv, "halvq", long_options, &option_index);
data/cwiid-0.6.91/wmgui/main.c:223:14:  [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, OPTSTRING)) != -1) {
data/cwiid-0.6.91/wmgui/main.c:251:23:  [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.
	else if ((str_addr = getenv(WIIMOTE_BDADDR)) != NULL) {
data/cwiid-0.6.91/wminput/main.c:163:7:  [3] (buffer) getopt_long:
  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.
		c = getopt_long (argc, argv, "hvc:dqr::w", long_options, &option_index);
data/cwiid-0.6.91/wminput/main.c:224:13:  [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 ((tmp = getenv("HOME")) == NULL) {
data/cwiid-0.6.91/wminput/main.c:260:23:  [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.
	else if ((str_addr = getenv(WIIMOTE_BDADDR)) != NULL) {
data/cwiid-0.6.91/libcwiid/command.c:91: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(buf+2, data, len);
data/cwiid-0.6.91/libcwiid/command.c:160: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[RPT_READ_REQ_LEN];
data/cwiid-0.6.91/libcwiid/command.c:218:3:  [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(cursor, &mesg.data, mesg.len);
data/cwiid-0.6.91/libcwiid/command.c:237: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[RPT_WRITE_LEN];
data/cwiid-0.6.91/libcwiid/command.c:264:3:  [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(buf+5, data+sent, buf[4]);
data/cwiid-0.6.91/libcwiid/command.c:333: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[SOUND_BUF_LEN] = { 0xA0, 0xC3, 0xC3, 0xC3, 0xC3,
data/cwiid-0.6.91/libcwiid/cwiid.h:346: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 name[BT_NAME_LEN];
data/cwiid-0.6.91/libcwiid/cwiid_internal.h:166: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 data[16];
data/cwiid-0.6.91/libcwiid/interface.c:150: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(state, &wiimote->state, sizeof *state);
data/cwiid-0.6.91/libcwiid/interface.c:166: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[7];
data/cwiid-0.6.91/libcwiid/interface.c:202: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[24];
data/cwiid-0.6.91/libcwiid/process.c:271: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(&rw_mesg.data, data+3, rw_mesg.len);
data/cwiid-0.6.91/libcwiid/state.c:51:4:  [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(wiimote->state.acc, mesg->acc_mesg.acc,
data/cwiid-0.6.91/libcwiid/state.c:55:4:  [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(wiimote->state.ir_src, mesg->ir_mesg.src,
data/cwiid-0.6.91/libcwiid/state.c:59:4:  [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(wiimote->state.ext.nunchuk.stick,
data/cwiid-0.6.91/libcwiid/state.c:62:4:  [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(wiimote->state.ext.nunchuk.acc,
data/cwiid-0.6.91/libcwiid/state.c:68:4:  [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(wiimote->state.ext.classic.l_stick,
data/cwiid-0.6.91/libcwiid/state.c:71:4:  [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(wiimote->state.ext.classic.r_stick,
data/cwiid-0.6.91/libcwiid/state.c:85:4:  [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(wiimote->state.ext.motionplus.angle_rate,
data/cwiid-0.6.91/libcwiid/state.c:137: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[RPT_MODE_BUF_LEN];
data/cwiid-0.6.91/libcwiid/thread.c:65: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[READ_BUF_LEN];
data/cwiid-0.6.91/libcwiid/thread.c:179: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[2];
data/cwiid-0.6.91/lswm/lswm.c:68: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 ba_str[18];
data/cwiid-0.6.91/wmgui/main.c:832:18:  [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 unsigned char buf[CWIID_MAX_READ_LEN];
data/cwiid-0.6.91/wmgui/main.c:833: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.
	static char txt[CWIID_MAX_READ_LEN*4+50]; /* 3 chars per byte, with
data/cwiid-0.6.91/wmgui/main.c:866:3:  [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(cursor, "0x%08X:", offset & ~0xF);
data/cwiid-0.6.91/wmgui/main.c:869:4:  [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(cursor, "   ");
data/cwiid-0.6.91/wmgui/main.c:874: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(cursor, "\n0x%08X:", offset+i);
data/cwiid-0.6.91/wmgui/main.c:881:4:  [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(cursor, "%02X ", buf[i]);
data/cwiid-0.6.91/wmgui/main.c:884:3:  [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(cursor, "\n\n");
data/cwiid-0.6.91/wmgui/main.c:897: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 str[2];
data/cwiid-0.6.91/wmgui/main.c:914:18:  [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 unsigned char buf[MAX_WRITE_LEN];
data/cwiid-0.6.91/wmgui/main.c:1024: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 battery[BATTERY_STR_LEN];
data/cwiid-0.6.91/wminput/c_plugin.c:70: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 pathname[PLUGIN_PATHNAME_LEN];
data/cwiid-0.6.91/wminput/conf.c:505: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 pathname[CONF_PATHNAME_LEN];
data/cwiid-0.6.91/wminput/conf.c:519:10:  [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 = fopen(filename, "r");
data/cwiid-0.6.91/wminput/conf.c:525:16:  [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).
			if ((file = fopen(pathname, "r"))) {
data/cwiid-0.6.91/wminput/conf.h:178: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 *config_filename_stack[CONF_MAX_INCLUDE_DEPTH];
data/cwiid-0.6.91/wminput/main.c:133: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 *config_search_dirs[3], *plugin_search_dirs[3];
data/cwiid-0.6.91/wminput/main.c:135: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 home_config_dir[HOME_DIR_LEN];
data/cwiid-0.6.91/wminput/main.c:136: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 home_plugin_dir[HOME_DIR_LEN];
data/cwiid-0.6.91/wminput/main.c:725:4:  [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(&plugin_mesg[plugin_mesg_count++], &mesg[i], sizeof mesg[i]);
data/cwiid-0.6.91/wminput/uinput.c:60:19:  [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).
		if ((conf->fd = open(uinput_filename[i], O_RDWR)) >= 0) {
data/cwiid-0.6.91/libcwiid/command.c:273:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(wiimote->rw_pipe[0], &mesg, sizeof mesg) != sizeof mesg) {
data/cwiid-0.6.91/libcwiid/thread.c:72:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		len = read(wiimote->int_socket, buf, READ_BUF_LEN);
data/cwiid-0.6.91/libcwiid/util.c:94:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(wiimote->ctl_socket, &handshake, 1) != 1) {
data/cwiid-0.6.91/libcwiid/util.c:140:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if ((last_len = read(fd, buf, len)) == -1) {
data/cwiid-0.6.91/wmdemo/wmdemo.c:95:11:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		switch (getchar()) {
data/cwiid-0.6.91/wmgui/main.c:878:5:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
				sprintf(cursor, " ");
data/cwiid-0.6.91/wminput/conf.c:307:6:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
	if (mismatch) {
data/cwiid-0.6.91/wminput/conf.c:427:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(conf->dev.name, UINPUT_NAME, UINPUT_MAX_NAME_SIZE);
data/cwiid-0.6.91/wminput/conf.c:539: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).
	  malloc(strlen(stackname) + 1)) == NULL) {
data/cwiid-0.6.91/wminput/uinput.c:251:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if ((len = read(data->conf->fd, &event, sizeof event)) !=

ANALYSIS SUMMARY:

Hits = 67
Lines analyzed = 12288 in approximately 0.35 seconds (35429 lines/second)
Physical Source Lines of Code (SLOC) = 9315
Hits@level = [0] 112 [1]  10 [2]  43 [3]   6 [4]   8 [5]   0
Hits@level+ = [0+] 179 [1+]  67 [2+]  57 [3+]  14 [4+]   8 [5+]   0
Hits/KSLOC@level+ = [0+] 19.2163 [1+] 7.1927 [2+] 6.11916 [3+] 1.50295 [4+] 0.85883 [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.