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/libratbag-0.15/ratbagd/ratbagd-button.c
Examining data/libratbag-0.15/ratbagd/ratbagd-device.c
Examining data/libratbag-0.15/ratbagd/ratbagd-json.c
Examining data/libratbag-0.15/ratbagd/ratbagd-json.h
Examining data/libratbag-0.15/ratbagd/ratbagd-led.c
Examining data/libratbag-0.15/ratbagd/ratbagd-profile.c
Examining data/libratbag-0.15/ratbagd/ratbagd-resolution.c
Examining data/libratbag-0.15/ratbagd/ratbagd-test.c
Examining data/libratbag-0.15/ratbagd/ratbagd-test.h
Examining data/libratbag-0.15/ratbagd/ratbagd.c
Examining data/libratbag-0.15/ratbagd/ratbagd.h
Examining data/libratbag-0.15/src/driver-etekcity.c
Examining data/libratbag-0.15/src/driver-gskill.c
Examining data/libratbag-0.15/src/driver-hidpp10.c
Examining data/libratbag-0.15/src/driver-hidpp20.c
Examining data/libratbag-0.15/src/driver-logitech-g300.c
Examining data/libratbag-0.15/src/driver-logitech-g600.c
Examining data/libratbag-0.15/src/driver-roccat-kone-pure.c
Examining data/libratbag-0.15/src/driver-roccat.c
Examining data/libratbag-0.15/src/driver-sinowealth-nubwo.c
Examining data/libratbag-0.15/src/driver-sinowealth.c
Examining data/libratbag-0.15/src/driver-steelseries.c
Examining data/libratbag-0.15/src/driver-test.c
Examining data/libratbag-0.15/src/hidpp-generic.c
Examining data/libratbag-0.15/src/hidpp-generic.h
Examining data/libratbag-0.15/src/hidpp10.c
Examining data/libratbag-0.15/src/hidpp10.h
Examining data/libratbag-0.15/src/hidpp20.c
Examining data/libratbag-0.15/src/hidpp20.h
Examining data/libratbag-0.15/src/liblur.c
Examining data/libratbag-0.15/src/liblur.h
Examining data/libratbag-0.15/src/libratbag-data.c
Examining data/libratbag-0.15/src/libratbag-data.h
Examining data/libratbag-0.15/src/libratbag-enums.h
Examining data/libratbag-0.15/src/libratbag-hidraw.c
Examining data/libratbag-0.15/src/libratbag-hidraw.h
Examining data/libratbag-0.15/src/libratbag-private.h
Examining data/libratbag-0.15/src/libratbag-test.c
Examining data/libratbag-0.15/src/libratbag-test.h
Examining data/libratbag-0.15/src/libratbag-util.c
Examining data/libratbag-0.15/src/libratbag-util.h
Examining data/libratbag-0.15/src/libratbag.c
Examining data/libratbag-0.15/src/libratbag.h
Examining data/libratbag-0.15/src/shared-macro.h
Examining data/libratbag-0.15/src/shared-rbtree.c
Examining data/libratbag-0.15/src/shared-rbtree.h
Examining data/libratbag-0.15/src/usb-ids.h
Examining data/libratbag-0.15/test/test-context.c
Examining data/libratbag-0.15/test/test-device.c
Examining data/libratbag-0.15/test/test-iconv-helper.c
Examining data/libratbag-0.15/test/test-util.c
Examining data/libratbag-0.15/tools/hidpp10-dump-page.c
Examining data/libratbag-0.15/tools/hidpp20-dump-page.c
Examining data/libratbag-0.15/tools/hidpp20-reset.c
Examining data/libratbag-0.15/tools/lur-command.c
Examining data/libratbag-0.15/tools/shared.c
Examining data/libratbag-0.15/tools/shared.h

FINAL RESULTS:

data/libratbag-0.15/ratbagd/ratbagd.c:59:3:  [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(fmt, args);
data/libratbag-0.15/ratbagd/ratbagd.c:70:3:  [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(fmt, args);
data/libratbag-0.15/ratbagd/ratbagd.c:80: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, fmt, args);
data/libratbag-0.15/src/hidpp-generic.c:385: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(format, args);
data/libratbag-0.15/src/hidpp-generic.h:96:26:  [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.
	__attribute__ ((format (printf, 3, 0)));
data/libratbag-0.15/src/hidpp-generic.h:163:26:  [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.
	__attribute__ ((format (printf, 3, 4)));
data/libratbag-0.15/src/libratbag-util.c:116:8:  [4] (format) vsnprintf:
  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.
	ret = vsnprintf(str, buf_len, format, args);
data/libratbag-0.15/src/libratbag-util.h:112:7:  [4] (format) vsnprintf:
  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.
	rc = vsnprintf(buf, n, fmt, args);
data/libratbag-0.15/src/libratbag-util.h:145:23:  [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.
__attribute__((format(printf, 1, 2)))
data/libratbag-0.15/src/libratbag-util.h:206:53:  [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.
		   const char *format, ...) __attribute__((format(printf, 4, 5)));
data/libratbag-0.15/src/libratbag-util.h:217:23:  [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.
__attribute__((format(printf, 2, 3)))
data/libratbag-0.15/src/libratbag.c:96: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(out, format, args);
data/libratbag-0.15/src/libratbag.h:35:26:  [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.
	__attribute__ ((format (printf, _format, _args)))
data/libratbag-0.15/src/shared-macro.h:70:49:  [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.
#define _printf_(_a, _b) __attribute__((format (printf, _a, _b)))
data/libratbag-0.15/tools/shared.h:54: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, format, args);
data/libratbag-0.15/src/libratbag-data.c:496: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.
	datadir = getenv("LIBRATBAG_DATA_DIR");
data/libratbag-0.15/src/libratbag-test.c:67:6:  [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("RATBAG_TEST") == NULL) {
data/libratbag-0.15/test/test-context.c:174:21:  [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.
	using_valgrind = !!getenv("USING_VALGRIND");
data/libratbag-0.15/tools/lur-command.c:197: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, "+h", opts, &option_index);
data/libratbag-0.15/tools/shared.c:33:24:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
	if ((path_canonical = realpath(path, NULL)) == NULL) {
data/libratbag-0.15/ratbagd/ratbagd-button.c:405: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 profile_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1],
data/libratbag-0.15/ratbagd/ratbagd-button.c:417:2:  [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(profile_buffer, "p%u", ratbagd_profile_get_index(profile));
data/libratbag-0.15/ratbagd/ratbagd-button.c:418:2:  [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(button_buffer, "b%u", index);
data/libratbag-0.15/ratbagd/ratbagd-device.c:212: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 model[64];
data/libratbag-0.15/ratbagd/ratbagd-json.c:301: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 keyname[32];
data/libratbag-0.15/ratbagd/ratbagd-json.c:323:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		event.value = atoi(m+1);
data/libratbag-0.15/ratbagd/ratbagd-led.c:298: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 profile_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1],
data/libratbag-0.15/ratbagd/ratbagd-led.c:310:2:  [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(profile_buffer, "p%u", ratbagd_profile_get_index(profile));
data/libratbag-0.15/ratbagd/ratbagd-led.c:311:2:  [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(led_buffer, "l%u", index);
data/libratbag-0.15/ratbagd/ratbagd-profile.c:562: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 index_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1];
data/libratbag-0.15/ratbagd/ratbagd-profile.c:575:2:  [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(index_buffer, "p%u", index);
data/libratbag-0.15/ratbagd/ratbagd-profile.c:723: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 index_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1];
data/libratbag-0.15/ratbagd/ratbagd-profile.c:726:2:  [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(index_buffer, "p%u", profile->index);
data/libratbag-0.15/ratbagd/ratbagd-profile.c:789: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 index_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1];
data/libratbag-0.15/ratbagd/ratbagd-profile.c:792:2:  [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(index_buffer, "p%u", profile->index);
data/libratbag-0.15/ratbagd/ratbagd-profile.c:855: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 index_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1];
data/libratbag-0.15/ratbagd/ratbagd-profile.c:858:2:  [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(index_buffer, "p%u", profile->index);
data/libratbag-0.15/ratbagd/ratbagd-resolution.c:289: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 profile_buffer[DECIMAL_TOKEN_MAX(unsigned int) + 1],
data/libratbag-0.15/ratbagd/ratbagd-resolution.c:305:2:  [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(profile_buffer, "p%u", ratbagd_profile_get_index(profile));
data/libratbag-0.15/ratbagd/ratbagd-resolution.c:306:2:  [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(resolution_buffer, "r%u", index);
data/libratbag-0.15/ratbagd/ratbagd-test.c:43: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 devicename[64];
data/libratbag-0.15/ratbagd/ratbagd.c:266:9:  [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).
	return open(path, flags, 0);
data/libratbag-0.15/ratbagd/ratbagd.c:536: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[40960];
data/libratbag-0.15/ratbagd/ratbagd.c:546: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).
	in = open(DBUS_POLICY_SRC, O_RDONLY);
data/libratbag-0.15/ratbagd/ratbagd.c:558:8:  [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).
	out = open(DBUS_POLICY_DST, O_CREAT|O_WRONLY, 0644);
data/libratbag-0.15/src/driver-etekcity.c:82: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[24];
data/libratbag-0.15/src/driver-gskill.c:238: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[256];
data/libratbag-0.15/src/driver-gskill.c:276: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 macro_name[256];
data/libratbag-0.15/src/driver-roccat-kone-pure.c:87: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 group[24];
data/libratbag-0.15/src/driver-roccat-kone-pure.c:88: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[24];
data/libratbag-0.15/src/driver-roccat-kone-pure.c:583:2:  [2] (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). Risk is low because the source is a constant string.
	strcpy(macro->group, "g0");
data/libratbag-0.15/src/driver-roccat.c:87: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 group[24];
data/libratbag-0.15/src/driver-roccat.c:88: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[24];
data/libratbag-0.15/src/driver-roccat.c:589:2:  [2] (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). Risk is low because the source is a constant string.
	strcpy(macro->group, "g0");
data/libratbag-0.15/src/driver-sinowealth-nubwo.c:190: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, DPI_CMD, ARRAY_LENGTH(DPI_CMD));
data/libratbag-0.15/src/driver-sinowealth-nubwo.c:202: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, REPORT_RATES_CMD, ARRAY_LENGTH(REPORT_RATES_CMD));
data/libratbag-0.15/src/driver-sinowealth-nubwo.c:245: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(report.cmd, AESTHETIC_CMD, ARRAY_LENGTH(AESTHETIC_CMD));
data/libratbag-0.15/src/driver-test.c:260: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(test_device, data, sizeof(*test_device));
data/libratbag-0.15/src/hidpp-generic.c:39: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 *hidpp10_errors[0x100] = {
data/libratbag-0.15/src/hidpp-generic.c:56: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 *hidpp20_errors[0x100] = {
data/libratbag-0.15/src/hidpp-generic.h:123: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 *hidpp10_errors[0x100];
data/libratbag-0.15/src/hidpp-generic.h:124: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 *hidpp20_errors[0x100];
data/libratbag-0.15/src/hidpp10.c:75: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 *device_types[0xFF] = {
data/libratbag-0.15/src/hidpp10.c:1057: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(macro, &memory[*index], sizeof(union hidpp10_macro_data));
data/libratbag-0.15/src/hidpp10.c:1144:5:  [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(tmp, macro, (count - 32) * sizeof(union hidpp10_macro_data));
data/libratbag-0.15/src/hidpp10.c:2441: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(&buffer[offset], &header, sizeof(header));
data/libratbag-0.15/src/hidpp10.c:2452: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(&buffer[offset], data, count);
data/libratbag-0.15/src/hidpp10.c:2530: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(bytes, readmem.msg.string, sizeof(readmem.msg.string));
data/libratbag-0.15/src/hidpp10.h:485: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 name[24]; /* the G700 has 23 chars, add one for terminating 0 */
data/libratbag-0.15/src/hidpp10.h:486: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 macro_names[11][18]; /* adding one extra terminating 0 per name */
data/libratbag-0.15/src/hidpp20.c:49: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 numeric[8];
data/libratbag-0.15/src/hidpp20.c:83: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 numeric[8];
data/libratbag-0.15/src/hidpp20.c:1828: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 txt[16 * 3];
data/libratbag-0.15/src/hidpp20.c:1911: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(data + offset, buf.msg.parameters, 16);
data/libratbag-0.15/src/hidpp20.c:1998: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(msg.msg.parameters, data, 16);
data/libratbag-0.15/src/hidpp20.c:2314: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(macro, &memory[*index], sizeof(union hidpp20_macro_data));
data/libratbag-0.15/src/hidpp20.c:2370:5:  [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(tmp, macro, (count - 32) * sizeof(union hidpp20_macro_data));
data/libratbag-0.15/src/hidpp20.c:2595: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(b, button, sizeof(*b));
data/libratbag-0.15/src/hidpp20.c:2646: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(b, button, sizeof(*b));
data/libratbag-0.15/src/hidpp20.c:2689: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(led->original, &internal_led, sizeof(internal_led));
data/libratbag-0.15/src/hidpp20.c:2908: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(internal_led, led->original, sizeof(*internal_led));
data/libratbag-0.15/src/hidpp20.c:2954: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(pdata->profile.name.txt, profile->name, sizeof(profile->name));
data/libratbag-0.15/src/hidpp20.h:877: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[16 * 3];
data/libratbag-0.15/src/liblur.c:200: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 name[name_size];
data/libratbag-0.15/src/libratbag-data.c:378: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[64];
data/libratbag-0.15/src/libratbag-hidraw.c:1575: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, tmp_buf, rc);
data/libratbag-0.15/src/libratbag-util.c:108: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[buf_len];
data/libratbag-0.15/src/libratbag.c:1148: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(resolutions, resolution->dpis,
data/libratbag-0.15/src/libratbag.c:1184: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(rates, profile->rates,
data/libratbag-0.15/src/libratbag.c:1705: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(button->action.macro->events,
data/libratbag-0.15/test/test-context.c:43: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).
	int fd = open(path, flags);
data/libratbag-0.15/test/test-iconv-helper.c:50: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 output[4096];
data/libratbag-0.15/test/test-iconv-helper.c:77: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 input[4096];
data/libratbag-0.15/test/test-iconv-helper.c:81: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(input, sample_utf16le, sizeof(sample_utf16le));
data/libratbag-0.15/test/test-iconv-helper.c:89: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(input, sample_emoji_utf16le, sizeof(sample_emoji_utf16le));
data/libratbag-0.15/test/test-iconv-helper.c:98: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(input, sample_single_char_utf16le,
data/libratbag-0.15/test/test-iconv-helper.c:111: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 output[10] = { 0 };
data/libratbag-0.15/tools/hidpp10-dump-page.c:96: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).
	fd = open(path, O_RDWR);
data/libratbag-0.15/tools/hidpp10-dump-page.c:108:10:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		page = atoi(argv[1]);
data/libratbag-0.15/tools/hidpp10-dump-page.c:110:13:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			offset = atoi(argv[2]);
data/libratbag-0.15/tools/hidpp20-dump-page.c:113: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).
	fd = open(path, O_RDWR);
data/libratbag-0.15/tools/hidpp20-dump-page.c:127:10:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		page = atoi(argv[1]);
data/libratbag-0.15/tools/hidpp20-dump-page.c:129:13:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			offset = atoi(argv[2]);
data/libratbag-0.15/tools/hidpp20-reset.c:89: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).
	fd = open(path, O_RDWR);
data/libratbag-0.15/tools/hidpp20-reset.c:103:12:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		sector = atoi(argv[1]);
data/libratbag-0.15/tools/lur-command.c:50: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).
	fd = open(path, O_RDWR);
data/libratbag-0.15/tools/lur-command.c:146: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 path[PATH_MAX] = {0};
data/libratbag-0.15/tools/lur-command.c:248:11:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		index = atoi(argv[2]);
data/libratbag-0.15/tools/shared.c:206: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[96];
data/libratbag-0.15/tools/shared.c:240: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[4096] = {0};
data/libratbag-0.15/tools/shared.c:336: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).
	int fd = open(path, flags);
data/libratbag-0.15/ratbagd/ratbagd-json.c:303: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).
	if (strlen(m) < 2)
data/libratbag-0.15/ratbagd/ratbagd-json.c:521:48:  [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 (!json_parser_load_from_data(parser, data, strlen(data), &error)) {
data/libratbag-0.15/ratbagd/ratbagd-profile.c:390:38:  [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 (u8_check((const uint8_t*)name, strlen(name)) == NULL)
data/libratbag-0.15/ratbagd/ratbagd.c:565:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	nread = read(in, buf, sizeof(buf));
data/libratbag-0.15/src/driver-etekcity.c:542:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(macro->name, action->macro->name, 23);
data/libratbag-0.15/src/driver-gskill.c:255:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		} read;
data/libratbag-0.15/src/driver-roccat-kone-pure.c:584:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(macro->name, action->macro->name, 23);
data/libratbag-0.15/src/driver-roccat.c:590:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(macro->name, action->macro->name, 23);
data/libratbag-0.15/src/hidpp-generic.c:301:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	rc = read(fd, buf, size);
data/libratbag-0.15/src/libratbag-data.c:480:8:  [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).
	len = strlen(name);
data/libratbag-0.15/src/libratbag-data.c:481: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).
	slen = strlen(SUFFIX);
data/libratbag-0.15/src/libratbag-hidraw.c:1656:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	rc = read(device->hidraw[hidrawno].fd, buf, len);
data/libratbag-0.15/src/libratbag-util.h:70:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(dest, src, n);
data/libratbag-0.15/src/libratbag-util.h:166: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(ms * 1000);
data/libratbag-0.15/src/libratbag.c:137: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).
	buf_len = header ? strlen(header) : 0;
data/libratbag-0.15/src/shared-macro.h:242: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(prefix);
data/libratbag-0.15/tools/shared.c:37:44:  [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 (strneq(path_canonical, hidraw_prefix, strlen(hidraw_prefix))) {

ANALYSIS SUMMARY:

Hits = 128
Lines analyzed = 34605 in approximately 0.79 seconds (43584 lines/second)
Physical Source Lines of Code (SLOC) = 24733
Hits@level = [0]  36 [1]  17 [2]  91 [3]   5 [4]  15 [5]   0
Hits@level+ = [0+] 164 [1+] 128 [2+] 111 [3+]  20 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 6.63082 [1+] 5.17527 [2+] 4.48793 [3+] 0.808636 [4+] 0.606477 [5+]   0
Dot directories skipped = 3 (--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.