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/gammastep-2.0.2/src/colorramp.c
Examining data/gammastep-2.0.2/src/colorramp.h
Examining data/gammastep-2.0.2/src/config-ini.c
Examining data/gammastep-2.0.2/src/config-ini.h
Examining data/gammastep-2.0.2/src/gamma-drm.c
Examining data/gammastep-2.0.2/src/gamma-drm.h
Examining data/gammastep-2.0.2/src/gamma-dummy.c
Examining data/gammastep-2.0.2/src/gamma-dummy.h
Examining data/gammastep-2.0.2/src/gamma-randr.c
Examining data/gammastep-2.0.2/src/gamma-randr.h
Examining data/gammastep-2.0.2/src/gamma-vidmode.c
Examining data/gammastep-2.0.2/src/gamma-vidmode.h
Examining data/gammastep-2.0.2/src/gamma-wl.c
Examining data/gammastep-2.0.2/src/gamma-wl.h
Examining data/gammastep-2.0.2/src/hooks.c
Examining data/gammastep-2.0.2/src/hooks.h
Examining data/gammastep-2.0.2/src/location-geoclue2.c
Examining data/gammastep-2.0.2/src/location-geoclue2.h
Examining data/gammastep-2.0.2/src/location-manual.c
Examining data/gammastep-2.0.2/src/location-manual.h
Examining data/gammastep-2.0.2/src/options.c
Examining data/gammastep-2.0.2/src/options.h
Examining data/gammastep-2.0.2/src/os-compatibility.c
Examining data/gammastep-2.0.2/src/os-compatibility.h
Examining data/gammastep-2.0.2/src/pipeutils.c
Examining data/gammastep-2.0.2/src/pipeutils.h
Examining data/gammastep-2.0.2/src/redshift.c
Examining data/gammastep-2.0.2/src/redshift.h
Examining data/gammastep-2.0.2/src/signals.c
Examining data/gammastep-2.0.2/src/signals.h
Examining data/gammastep-2.0.2/src/solar.c
Examining data/gammastep-2.0.2/src/solar.h
Examining data/gammastep-2.0.2/src/systemtime.c
Examining data/gammastep-2.0.2/src/systemtime.h
Examining data/gammastep-2.0.2/src/vlog.c
Examining data/gammastep-2.0.2/src/vlog.h

FINAL RESULTS:

data/gammastep-2.0.2/src/gamma-drm.c:79:2:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
	sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, state->card_num);
data/gammastep-2.0.2/src/hooks.c:81:12:  [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.
			int r = execl(hook_path, hook_name,
data/gammastep-2.0.2/src/os-compatibility.c:118:2:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
	strcpy(name, path);
data/gammastep-2.0.2/src/os-compatibility.c:119:2:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
	strcat(name, template);
data/gammastep-2.0.2/src/vlog.c:18: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, ap);
data/gammastep-2.0.2/src/config-ini.c:50:27:  [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 (f == NULL && (env = getenv("XDG_CONFIG_HOME")) != NULL &&
data/gammastep-2.0.2/src/config-ini.c:57:27:  [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 (f == NULL && (env = getenv("HOME")) != NULL &&
data/gammastep-2.0.2/src/config-ini.c:72:27:  [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 (f == NULL && (env = getenv("XDG_CONFIG_DIRS")) != NULL &&
data/gammastep-2.0.2/src/hooks.c:36:13:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
	if ((env = getenv("XDG_CONFIG_HOME")) != NULL &&
data/gammastep-2.0.2/src/hooks.c:42:13:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
	if ((env = getenv("HOME")) != NULL &&
data/gammastep-2.0.2/src/options.c:490:16:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
	while ((opt = getopt(argc, argv, "b:c:g:hl:m:oO:pPrt:vVx")) != -1) {
data/gammastep-2.0.2/src/os-compatibility.c:107: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.
	const char *path = getenv("XDG_RUNTIME_DIR");
data/gammastep-2.0.2/src/config-ini.c:47: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 cp[MAX_CONFIG_PATH];
data/gammastep-2.0.2/src/config-ini.c:54:8:  [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).
			f = fopen(cp, "r");
data/gammastep-2.0.2/src/config-ini.c:61:8:  [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).
			f = fopen(cp, "r");
data/gammastep-2.0.2/src/config-ini.c:69:8:  [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).
			f = fopen(cp, "r");
data/gammastep-2.0.2/src/config-ini.c:84:10:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
					f = fopen(cp, "r");
data/gammastep-2.0.2/src/config-ini.c:95:8:  [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).
			f = fopen(cp, "r");
data/gammastep-2.0.2/src/config-ini.c:100:7:  [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).
		f = fopen(filepath, "r");
data/gammastep-2.0.2/src/config-ini.c:123: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 line[MAX_LINE_LENGTH];
data/gammastep-2.0.2/src/config-ini.c:174: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(section->name, name, end - name + 1);
data/gammastep-2.0.2/src/config-ini.c:220: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(setting->name, s, end - s + 1);
data/gammastep-2.0.2/src/config-ini.c:231: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(setting->value, value, value_len);
data/gammastep-2.0.2/src/gamma-drm.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 pathname[maxlen];
data/gammastep-2.0.2/src/gamma-drm.c:81:14:  [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).
	state->fd = open(pathname, O_RDWR | O_CLOEXEC);
data/gammastep-2.0.2/src/gamma-drm.c:245:21:  [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).
		state->card_num = atoi(value);
data/gammastep-2.0.2/src/gamma-drm.c:247:21:  [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).
		state->crtc_num = atoi(value);
data/gammastep-2.0.2/src/gamma-randr.c:229: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(&state->crtcs[i].saved_ramps[0*ramp_size], gamma_r,
data/gammastep-2.0.2/src/gamma-randr.c:231: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(&state->crtcs[i].saved_ramps[1*ramp_size], gamma_g,
data/gammastep-2.0.2/src/gamma-randr.c:233: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(&state->crtcs[i].saved_ramps[2*ramp_size], gamma_b,
data/gammastep-2.0.2/src/gamma-randr.c:306:23:  [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).
		state->screen_num = atoi(value);
data/gammastep-2.0.2/src/gamma-randr.c:401: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(gamma_ramps, state->crtcs[crtc_num].saved_ramps,
data/gammastep-2.0.2/src/gamma-vidmode.c:143:23:  [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).
		state->screen_num = atoi(value);
data/gammastep-2.0.2/src/gamma-vidmode.c:193: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(gamma_ramps, state->saved_ramps,
data/gammastep-2.0.2/src/gamma-wl.c:140: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(output, &state->outputs[state->num_outputs], sizeof(struct output));
data/gammastep-2.0.2/src/hooks.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 hooksdir_path[MAX_HOOK_PATH];
data/gammastep-2.0.2/src/hooks.c:67: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 hook_path[MAX_HOOK_PATH];
data/gammastep-2.0.2/src/options.c:435:23:  [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).
		options->temp_set = atoi(value);
data/gammastep-2.0.2/src/options.c:454:37:  [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).
		options->scheme.day.temperature = atoi(value);
data/gammastep-2.0.2/src/options.c:455:39:  [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).
		options->scheme.night.temperature = atoi(s);
data/gammastep-2.0.2/src/options.c:508:38:  [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).
			options->scheme.day.temperature = atoi(value);
data/gammastep-2.0.2/src/options.c:512:40:  [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).
			options->scheme.night.temperature = atoi(value);
data/gammastep-2.0.2/src/options.c:519:26:  [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).
			options->use_fade = !!atoi(value);
data/gammastep-2.0.2/src/os-compatibility.c:72:7:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
	fd = mkstemp(tmpname);
data/gammastep-2.0.2/src/config-ini.c:223: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).
			size_t value_len = strlen(value) + 1;
data/gammastep-2.0.2/src/gamma-drm.c:76:16:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10;
data/gammastep-2.0.2/src/gamma-drm.c:76:39:  [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).
	long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10;
data/gammastep-2.0.2/src/os-compatibility.c:65:22:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	mode_t prev_umask = umask(0066);
data/gammastep-2.0.2/src/os-compatibility.c:78:2:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	umask(prev_umask);
data/gammastep-2.0.2/src/os-compatibility.c:113:22:  [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 *name = malloc(strlen(path) + sizeof(template));
data/gammastep-2.0.2/src/pipeutils.c:67:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(read_fd, &data, 1);

ANALYSIS SUMMARY:

Hits = 51
Lines analyzed = 5816 in approximately 0.24 seconds (23955 lines/second)
Physical Source Lines of Code (SLOC) = 4362
Hits@level = [0]  62 [1]   7 [2]  32 [3]   7 [4]   5 [5]   0
Hits@level+ = [0+] 113 [1+]  51 [2+]  44 [3+]  12 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 25.9055 [1+] 11.6919 [2+] 10.0871 [3+] 2.75103 [4+] 1.14626 [5+]   0
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.