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/gamemode-1.6/common/common-external.c Examining data/gamemode-1.6/common/common-external.h Examining data/gamemode-1.6/common/common-governors.c Examining data/gamemode-1.6/common/common-governors.h Examining data/gamemode-1.6/common/common-gpu.c Examining data/gamemode-1.6/common/common-gpu.h Examining data/gamemode-1.6/common/common-helpers.c Examining data/gamemode-1.6/common/common-helpers.h Examining data/gamemode-1.6/common/common-logging.c Examining data/gamemode-1.6/common/common-logging.h Examining data/gamemode-1.6/common/common-pidfds.c Examining data/gamemode-1.6/common/common-pidfds.h Examining data/gamemode-1.6/common/common-power.c Examining data/gamemode-1.6/common/common-power.h Examining data/gamemode-1.6/daemon/gamemode-config.c Examining data/gamemode-1.6/daemon/gamemode-config.h Examining data/gamemode-1.6/daemon/gamemode-context.c Examining data/gamemode-1.6/daemon/gamemode-dbus.c Examining data/gamemode-1.6/daemon/gamemode-gpu.c Examining data/gamemode-1.6/daemon/gamemode-ioprio.c Examining data/gamemode-1.6/daemon/gamemode-sched.c Examining data/gamemode-1.6/daemon/gamemode-wine.c Examining data/gamemode-1.6/daemon/gamemode.h Examining data/gamemode-1.6/daemon/gamemoded.c Examining data/gamemode-1.6/daemon/gamemode-tests.c Examining data/gamemode-1.6/example/main.c Examining data/gamemode-1.6/lib/client_impl.c Examining data/gamemode-1.6/lib/client_loader.c Examining data/gamemode-1.6/lib/gamemode_client.h Examining data/gamemode-1.6/subprojects/inih/ini.h Examining data/gamemode-1.6/subprojects/inih/tests/unittest_string.c Examining data/gamemode-1.6/subprojects/inih/tests/unittest.c Examining data/gamemode-1.6/subprojects/inih/ini.c Examining data/gamemode-1.6/subprojects/inih/examples/ini_dump.c Examining data/gamemode-1.6/subprojects/inih/examples/ini_xmacros.c Examining data/gamemode-1.6/subprojects/inih/examples/ini_example.c Examining data/gamemode-1.6/subprojects/inih/examples/INIReaderExample.cpp Examining data/gamemode-1.6/subprojects/inih/cpp/INIReader.cpp Examining data/gamemode-1.6/subprojects/inih/cpp/INIReader.h Examining data/gamemode-1.6/util/cpugovctl.c Examining data/gamemode-1.6/util/gpuclockctl.c FINAL RESULTS: data/gamemode-1.6/daemon/gamemode-tests.c:187:6: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if (readlink("/proc/self/exe", mypath, PATH_MAX) == -1) { data/gamemode-1.6/common/common-external.c:143:7: [4] (shell) execv: 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 (execv(exec_args[0], (char *const *)exec_args) != 0) { data/gamemode-1.6/common/common-helpers.h:48:3: [4] (format) snprintf: 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. (snprintf(b, sizeof(b), s, __VA_ARGS__) < (ssize_t)sizeof(b) ? b : NULL) data/gamemode-1.6/common/common-helpers.h:54:3: [4] (format) snprintf: 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. (snprintf(b, sizeof(b), s, __VA_ARGS__) < (ssize_t)sizeof(b) ? strndup(b, sizeof(b)) : NULL) data/gamemode-1.6/common/common-logging.h:42: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. #define PLOG_MSG(...) printf(__VA_ARGS__) data/gamemode-1.6/common/common-logging.h:43:25: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #define SYSLOG_MSG(...) syslog(LOG_INFO, __VA_ARGS__) data/gamemode-1.6/common/common-logging.h:53:25: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define PLOG_ERROR(...) fprintf(stderr, "ERROR: " __VA_ARGS__) data/gamemode-1.6/common/common-logging.h:54:27: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #define SYSLOG_ERROR(...) syslog(LOG_ERR, __VA_ARGS__) data/gamemode-1.6/daemon/gamemode-dbus.c:305:2: [4] (format) snprintf: 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. snprintf(path, GAME_PATH_MAX, GAME_PATH_PREFIX "/%u", (uint32_t)pid); data/gamemode-1.6/daemon/gamemode-tests.c:196:7: [4] (shell) execl: 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 (execl(mypath, mypath, "-r", (char *)NULL) == -1) { data/gamemode-1.6/daemon/gamemode-tests.c:271:7: [4] (shell) execl: 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 (execl("/usr/games/gamemoderun", "/usr/games/gamemoderun", "sleep", "5", (char *)NULL) == data/gamemode-1.6/daemon/gamemoded.c:306:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, USAGE_TEXT, argv[0]); data/gamemode-1.6/lib/client_impl.c:68:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEBUG(...) fprintf(stderr, __VA_ARGS__) data/gamemode-1.6/lib/client_impl.c:72:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define TRACE(...) fprintf(stderr, __VA_ARGS__) data/gamemode-1.6/lib/client_impl.c:78:66: [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. static int log_error(const char *fmt, ...) __attribute__((format(printf, 1, 2))); data/gamemode-1.6/lib/client_impl.c:134:6: [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. n = vsnprintf(error_string, sizeof(error_string), fmt, args); data/gamemode-1.6/util/gpuclockctl.c:141:2: [4] (format) snprintf: 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. snprintf(arg, NV_ARG_MAX, NV_ATTRIBUTE_FORMAT, info->device, NV_PERFMODES_ATTRIBUTE); data/gamemode-1.6/util/gpuclockctl.c:175:2: [4] (format) snprintf: 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. snprintf(arg, data/gamemode-1.6/util/gpuclockctl.c:192:2: [4] (format) snprintf: 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. snprintf(arg, data/gamemode-1.6/util/gpuclockctl.c:209:2: [4] (format) snprintf: 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. snprintf(arg, NV_ARG_MAX, NV_ATTRIBUTE_FORMAT, info->device, NV_POWERMIZER_MODE_ATTRIBUTE); data/gamemode-1.6/util/gpuclockctl.c:244:3: [4] (format) snprintf: 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. snprintf(arg, data/gamemode-1.6/util/gpuclockctl.c:258:3: [4] (format) snprintf: 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. snprintf(arg, data/gamemode-1.6/util/gpuclockctl.c:272:3: [4] (format) snprintf: 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. snprintf(arg, data/gamemode-1.6/util/gpuclockctl.c:297:2: [4] (format) snprintf: 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. snprintf(path, PATH_MAX, AMD_DRM_PATH, info->device, "power_dpm_force_performance_level"); data/gamemode-1.6/util/gpuclockctl.c:333:2: [4] (format) snprintf: 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. snprintf(path, PATH_MAX, AMD_DRM_PATH, device, filename); data/gamemode-1.6/common/common-governors.c:75:21: [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. const char *ptr = realpath(glo.gl_pathv[i], fullpath); data/gamemode-1.6/daemon/gamemode-config.c:337:20: [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. const char *cfg = getenv("XDG_CONFIG_HOME"); data/gamemode-1.6/daemon/gamemode-config.c:339:26: [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. config_location_home = realpath(cfg, NULL); data/gamemode-1.6/daemon/gamemode-config.c:341:9: [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. cfg = getenv("HOME"); data/gamemode-1.6/daemon/gamemode-config.c:345:28: [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. config_location_home = realpath(cfg_full, NULL); data/gamemode-1.6/daemon/gamemode-config.c:351:28: [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. config_location_home = realpath(p->pw_dir, NULL); data/gamemode-1.6/daemon/gamemode-wine.c:218:25: [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. wine_exe = wine_path ? realpath(wine_path, NULL) : NULL; data/gamemode-1.6/daemon/gamemoded.c:171:16: [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. while ((opt = getopt_long(argc, argv, short_options, long_options, 0)) != -1) { data/gamemode-1.6/util/gpuclockctl.c:135:7: [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("DISPLAY")) data/gamemode-1.6/util/gpuclockctl.c:165:7: [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("DISPLAY")) data/gamemode-1.6/util/gpuclockctl.c:233:7: [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("DISPLAY") || !getenv("XAUTHORITY")) data/gamemode-1.6/util/gpuclockctl.c:233:29: [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("DISPLAY") || !getenv("XAUTHORITY")) data/gamemode-1.6/common/common-external.c:42:43: [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 int read_child_stdout(int pipe_fd, char buffer[EXTERNAL_BUFFER_MAX], int tsec) data/gamemode-1.6/common/common-external.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 discard_buffer[EXTERNAL_BUFFER_MAX]; data/gamemode-1.6/common/common-external.c:108:32: [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. int run_external_process(const char *const *exec_args, char buffer[EXTERNAL_BUFFER_MAX], int tsec) data/gamemode-1.6/common/common-external.c:108:56: [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. int run_external_process(const char *const *exec_args, char buffer[EXTERNAL_BUFFER_MAX], int tsec) data/gamemode-1.6/common/common-external.c:114:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char internal[EXTERNAL_BUFFER_MAX] = { 0 }; data/gamemode-1.6/common/common-external.c:169: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, internal, EXTERNAL_BUFFER_MAX); data/gamemode-1.6/common/common-external.h:37:32: [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. int run_external_process(const char *const *exec_args, char buffer[EXTERNAL_BUFFER_MAX], int tsec); data/gamemode-1.6/common/common-external.h:37:56: [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. int run_external_process(const char *const *exec_args, char buffer[EXTERNAL_BUFFER_MAX], int tsec); data/gamemode-1.6/common/common-governors.c:45:21: [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. int fetch_governors(char governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH]) data/gamemode-1.6/common/common-governors.c:74: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 fullpath[PATH_MAX] = { 0 }; data/gamemode-1.6/common/common-governors.c:103: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 governor[64] = { 0 }; data/gamemode-1.6/common/common-governors.c:107: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 governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH] = { { 0 } }; data/gamemode-1.6/common/common-governors.c:114: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 *f = fopen(gov, "r"); data/gamemode-1.6/common/common-governors.c:131: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 contents[length]; data/gamemode-1.6/common/common-governors.h:42:21: [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. int fetch_governors(char governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH]); data/gamemode-1.6/common/common-gpu.c:40: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[64] = { 0 }; data/gamemode-1.6/common/common-gpu.c:45:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen(path, "r"); data/gamemode-1.6/common/common-gpu.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 buff[64]; data/gamemode-1.6/common/common-gpu.h:55: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 amd_performance_level[GPU_VALUE_MAX]; /* The AMD performance level set to */ data/gamemode-1.6/common/common-pidfds.c:120: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/gamemode-1.6/common/common-pidfds.c:199: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("/proc/self/fdinfo", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY); data/gamemode-1.6/common/common-power.c:47: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]; data/gamemode-1.6/common/common-power.c:54:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *f = fopen(path, "r"); data/gamemode-1.6/common/common-power.c:113: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[32]; data/gamemode-1.6/common/common-power.c:124:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char energy_uj_str[32]; data/gamemode-1.6/daemon/gamemode-config.c:78: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 whitelist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:79: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 blacklist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:82: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 startscripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:83: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 endscripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:85: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 defaultgov[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:86: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 desiredgov[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:88: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 igpu_desiredgov[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:91: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 softrealtime[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:94: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 ioprio[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:100: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 apply_gpu_optimisations[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:105: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 amd_performance_level[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:108: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 supervisor_whitelist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:109: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 supervisor_blacklist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-config.c:116:40: [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 bool append_value_to_list(const char *list_name, const char *value, data/gamemode-1.6/daemon/gamemode-config.c:116:63: [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 bool append_value_to_list(const char *list_name, const char *value, data/gamemode-1.6/daemon/gamemode-config.c:117:34: [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 list[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:213:47: [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 bool config_string_list_contains(const char *needle, data/gamemode-1.6/daemon/gamemode-config.c:214:41: [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 haystack[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:227:36: [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 bool get_string_value(const char *value, char output[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:227:49: [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 bool get_string_value(const char *value, char output[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:393: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). if ((f = fopen(path, "r"))) { data/gamemode-1.6/daemon/gamemode-config.c:443: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(dst, src, n); data/gamemode-1.6/daemon/gamemode-config.c:519: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[buflen] __attribute__((aligned(__alignof__(struct inotify_event)))); data/gamemode-1.6/daemon/gamemode-config.c:638:40: [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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:650:38: [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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:663:56: [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. void config_get_default_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:671:56: [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. void config_get_desired_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:679:61: [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. void config_get_igpu_desired_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:708:53: [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. void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:737: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 ioprio_value[CONFIG_VALUE_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-config.c:746: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). value = atoi(ioprio_value); data/gamemode-1.6/daemon/gamemode-config.c:769:63: [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. void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.c:783:61: [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. void config_get_amd_performance_level(GameModeConfig *self, char value[CONFIG_VALUE_MAX]) data/gamemode-1.6/daemon/gamemode-config.h:93:40: [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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:95:38: [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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:103:56: [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. void config_get_default_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:104:56: [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. void config_get_desired_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:105:61: [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. void config_get_igpu_desired_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:107:53: [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. void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:114:63: [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. void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-config.h:119:61: [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. void config_get_amd_performance_level(GameModeConfig *self, char value[CONFIG_VALUE_MAX]); data/gamemode-1.6/daemon/gamemode-context.c:63: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 executable[PATH_MAX]; /**<Process executable */ data/gamemode-1.6/daemon/gamemode-context.c:80: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 initial_cpu_mode[64]; /**<Only updates when we can */ data/gamemode-1.6/daemon/gamemode-context.c:113:39: [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 void game_mode_execute_scripts(char scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX], int timeout); data/gamemode-1.6/daemon/gamemode-context.c:216: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 gov_config_str[CONFIG_VALUE_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-context.c:369: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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-context.c:398: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 scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-context.c:964: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[PATH_MAX]; data/gamemode-1.6/daemon/gamemode-context.c:1006:39: [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 void game_mode_execute_scripts(char scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX], int timeout) data/gamemode-1.6/daemon/gamemode-dbus.c:303:52: [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 inline void game_object_bus_path(pid_t pid, char path[static GAME_PATH_MAX]) data/gamemode-1.6/daemon/gamemode-dbus.c:331: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 path[GAME_PATH_MAX] = { data/gamemode-1.6/daemon/gamemode-dbus.c:358: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[GAME_PATH_MAX] = { data/gamemode-1.6/daemon/gamemode-dbus.c:481: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 bus_path[GAME_PATH_MAX] = {0, }; data/gamemode-1.6/daemon/gamemode-gpu.c:57: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 apply[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-gpu.c:158: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 device[4]; data/gamemode-1.6/daemon/gamemode-gpu.c:161: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 nv_core[8]; data/gamemode-1.6/daemon/gamemode-gpu.c:163: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 nv_mem[8]; data/gamemode-1.6/daemon/gamemode-gpu.c:165: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 nv_powermizer_mode[4]; data/gamemode-1.6/daemon/gamemode-gpu.c:194: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 device[4]; data/gamemode-1.6/daemon/gamemode-gpu.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 buffer[EXTERNAL_BUFFER_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-ioprio.c:138: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 tasks[128]; data/gamemode-1.6/daemon/gamemode-ioprio.c:155: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). int tid = atoi(tid_entry->d_name); data/gamemode-1.6/daemon/gamemode-sched.c:99: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 tasks[128]; data/gamemode-1.6/daemon/gamemode-sched.c:116: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). int tid = atoi(tid_entry->d_name); data/gamemode-1.6/daemon/gamemode-sched.c:159: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 softrealtime[CONFIG_VALUE_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-tests.c:185: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 mypath[PATH_MAX]; data/gamemode-1.6/daemon/gamemode-tests.c:317: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 desiredgov[CONFIG_VALUE_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-tests.c:321:3: [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(desiredgov, "performance"); data/gamemode-1.6/daemon/gamemode-tests.c:323: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 defaultgov[CONFIG_VALUE_MAX] = { 0 }; data/gamemode-1.6/daemon/gamemode-tests.c:367: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 startscripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-tests.c:390: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 endscripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-tests.c:424: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 apply[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-tests.c:450: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 expected_amd_performance_level[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-tests.c:459: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 original_amd_performance_level[CONFIG_VALUE_MAX]; data/gamemode-1.6/daemon/gamemode-wine.c:66: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[PATH_MAX]; data/gamemode-1.6/daemon/gamemode-wine.c:69:21: [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 proc_path ? open(proc_path, O_RDONLY | O_CLOEXEC) : INVALID_PROCFD; data/gamemode-1.6/daemon/gamemode-wine.c:149: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[PATH_MAX]; data/gamemode-1.6/daemon/gamemoded.c:133:18: [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 devnull_r = open("/dev/null", O_RDONLY); data/gamemode-1.6/daemon/gamemoded.c:134:18: [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 devnull_w = open("/dev/null", O_WRONLY); data/gamemode-1.6/daemon/gamemoded.c:182: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). pid_t pid = atoi(optarg); data/gamemode-1.6/daemon/gamemoded.c:225: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). pid_t pid = atoi(optarg); data/gamemode-1.6/lib/client_impl.c:81: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. static char error_string[512] = { 0 }; data/gamemode-1.6/lib/client_impl.c:196: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 action[256] = { data/gamemode-1.6/lib/gamemode_client.h:85: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. static char internal_gamemode_client_error_string[512] = { 0 }; data/gamemode-1.6/lib/gamemode_client.h:132: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(out_func, &symbol_lookup, func_size); data/gamemode-1.6/subprojects/inih/examples/ini_dump.c:10: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. static char prev_section[50] = ""; data/gamemode-1.6/subprojects/inih/examples/ini_example.c:22:28: [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). pconfig->version = atoi(value); data/gamemode-1.6/subprojects/inih/ini.c:88:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[INI_MAX_LINE]; data/gamemode-1.6/subprojects/inih/ini.c:98:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char section[MAX_SECTION] = ""; data/gamemode-1.6/subprojects/inih/ini.c:99:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char prev_name[MAX_NAME] = ""; data/gamemode-1.6/subprojects/inih/ini.c:241:12: [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/gamemode-1.6/subprojects/inih/tests/unittest.c:19: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 Prev_section[50]; data/gamemode-1.6/subprojects/inih/tests/unittest_string.c:9: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 Prev_section[50]; data/gamemode-1.6/util/cpugovctl.c:44: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 governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH] = { { 0 } }; data/gamemode-1.6/util/cpugovctl.c:51: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 *f = fopen(gov, "w"); data/gamemode-1.6/util/gpuclockctl.c:72: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 out[EXTERNAL_BUFFER_MAX]; data/gamemode-1.6/util/gpuclockctl.c:138: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 arg[NV_ARG_MAX] = { 0 }; data/gamemode-1.6/util/gpuclockctl.c:170: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 arg[NV_ARG_MAX] = { 0 }; data/gamemode-1.6/util/gpuclockctl.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 arg[NV_ARG_MAX] = { 0 }; data/gamemode-1.6/util/gpuclockctl.c:296: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]; data/gamemode-1.6/util/gpuclockctl.c:299:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen(path, "r"); data/gamemode-1.6/util/gpuclockctl.c:307: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 buff[GPU_VALUE_MAX] = { 0 }; data/gamemode-1.6/util/gpuclockctl.c:332: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]; data/gamemode-1.6/util/gpuclockctl.c:335:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen(path, "w"); data/gamemode-1.6/common/common-external.c:75:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). just_read = read(pipe_fd, data/gamemode-1.6/common/common-external.c:79:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). just_read = read(pipe_fd, discard_buffer, EXTERNAL_BUFFER_MAX - 1); data/gamemode-1.6/common/common-governors.c:89:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(governors[num_governors], fullpath, MAX_GOVERNOR_LENGTH); data/gamemode-1.6/common/common-governors.c:136: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). if (strlen(governor) > 0 && strncmp(governor, contents, 64) != 0) { data/gamemode-1.6/common/common-governors.c:144:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(governor, contents, sizeof(governor) - 1); data/gamemode-1.6/common/common-helpers.h:62:14: [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 (pos && (strlen(pos) == strlen(needle))) data/gamemode-1.6/common/common-helpers.h:62: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). if (pos && (strlen(pos) == strlen(needle))) data/gamemode-1.6/common/common-power.c:65:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read <= 0) { data/gamemode-1.6/common/common-power.c:70:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read >= n) { data/gamemode-1.6/common/common-power.c:76:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). dest[read] = '\0'; data/gamemode-1.6/common/common-power.c:79:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read > 0 && isspace(dest[read - 1])) { data/gamemode-1.6/daemon/gamemode-config.c:124:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(list[i], value, CONFIG_VALUE_MAX); data/gamemode-1.6/daemon/gamemode-config.c:229:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(output, value, CONFIG_VALUE_MAX - 1); data/gamemode-1.6/daemon/gamemode-config.c:521:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t len = read(self->inotfd, buffer, buflen); data/gamemode-1.6/daemon/gamemode-config.c:543:54: [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 (strncmp(basename(event->name), CONFIG_NAME, strlen(CONFIG_NAME)) == 0) { data/gamemode-1.6/daemon/gamemode-context.c:210:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(self->initial_cpu_mode, initial_state, sizeof(self->initial_cpu_mode) - 1); data/gamemode-1.6/daemon/gamemode-context.c:807:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ret->executable, executable, PATH_MAX - 1); data/gamemode-1.6/daemon/gamemode-dbus.c:451: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). if (strncmp(path, prefix, strlen(prefix)) != 0) data/gamemode-1.6/daemon/gamemode-dbus.c:454:17: [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). start = path + strlen(prefix); data/gamemode-1.6/daemon/gamemode-gpu.c:59: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(apply) == 0) { data/gamemode-1.6/daemon/gamemode-gpu.c:225:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info->amd_performance_level, buffer, sizeof(info->amd_performance_level) - 1); data/gamemode-1.6/daemon/gamemode-tests.c:206: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(10000); data/gamemode-1.6/daemon/gamemode-tests.c:239: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(100000); data/gamemode-1.6/daemon/gamemode-tests.c:245: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(100000); data/gamemode-1.6/daemon/gamemode-tests.c:279: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(100000); data/gamemode-1.6/daemon/gamemode-tests.c:295: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(100000); data/gamemode-1.6/daemon/gamemode-tests.c:328:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(defaultgov, currentgov, CONFIG_VALUE_MAX - 1); data/gamemode-1.6/daemon/gamemode-tests.c:426: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(apply) == 0) { data/gamemode-1.6/daemon/gamemode-tests.c:451:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(expected_amd_performance_level, gpuinfo->amd_performance_level, CONFIG_VALUE_MAX - 1); data/gamemode-1.6/daemon/gamemode-tests.c:460:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(original_amd_performance_level, gpuinfo->amd_performance_level, CONFIG_VALUE_MAX - 1); data/gamemode-1.6/daemon/gamemode-tests.c:962: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(100000); data/gamemode-1.6/daemon/gamemode-tests.c:965: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(100000); data/gamemode-1.6/daemon/gamemode-wine.c:95:17: [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 pos = strlen(var) + 1; data/gamemode-1.6/daemon/gamemode-wine.c:98: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 ((len > pos) && (strncmp(line, var, strlen(var)) == 0) && (line[pos - 1] == '=')) data/gamemode-1.6/daemon/gamemode-wine.c:108: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). if (environ && !strlen(environ)) { data/gamemode-1.6/daemon/gamemoded.c:124:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0022); data/gamemode-1.6/subprojects/inih/examples/ini_dump.c:14:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(prev_section, section, sizeof(prev_section)); data/gamemode-1.6/subprojects/inih/ini.c:40:19: [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). char* p = s + strlen(s); data/gamemode-1.6/subprojects/inih/ini.c:77:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, size - 1); data/gamemode-1.6/subprojects/inih/ini.c:124: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). offset = strlen(line); data/gamemode-1.6/subprojects/inih/ini.c:139:23: [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). offset += strlen(line + offset); data/gamemode-1.6/subprojects/inih/ini.c:281:20: [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). ctx.num_left = strlen(string); data/gamemode-1.6/subprojects/inih/tests/unittest.c:32:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Prev_section, section, sizeof(Prev_section)); data/gamemode-1.6/subprojects/inih/tests/unittest_string.c:17:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Prev_section, section, sizeof(Prev_section)); data/gamemode-1.6/util/gpuclockctl.c:320:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info->amd_performance_level, buff, GPU_VALUE_MAX - 1); data/gamemode-1.6/util/gpuclockctl.c:471:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.amd_performance_level, argv[3], GPU_VALUE_MAX - 1); ANALYSIS SUMMARY: Hits = 212 Lines analyzed = 8904 in approximately 0.32 seconds (27749 lines/second) Physical Source Lines of Code (SLOC) = 5244 Hits@level = [0] 53 [1] 46 [2] 129 [3] 12 [4] 24 [5] 1 Hits@level+ = [0+] 265 [1+] 212 [2+] 166 [3+] 37 [4+] 25 [5+] 1 Hits/KSLOC@level+ = [0+] 50.5339 [1+] 40.4272 [2+] 31.6552 [3+] 7.05568 [4+] 4.76735 [5+] 0.190694 Dot directories skipped = 2 (--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.