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/rauc-1.4/include/bootchooser.h
Examining data/rauc-1.4/include/bundle.h
Examining data/rauc-1.4/include/checksum.h
Examining data/rauc-1.4/include/config_file.h
Examining data/rauc-1.4/include/context.h
Examining data/rauc-1.4/include/emmc.h
Examining data/rauc-1.4/include/gpt.h
Examining data/rauc-1.4/include/install.h
Examining data/rauc-1.4/include/manifest.h
Examining data/rauc-1.4/include/mark.h
Examining data/rauc-1.4/include/mbr.h
Examining data/rauc-1.4/include/mount.h
Examining data/rauc-1.4/include/service.h
Examining data/rauc-1.4/include/signature.h
Examining data/rauc-1.4/include/slot.h
Examining data/rauc-1.4/include/update_handler.h
Examining data/rauc-1.4/include/utils.h
Examining data/rauc-1.4/include/network.h
Examining data/rauc-1.4/src/bootchooser.c
Examining data/rauc-1.4/src/bundle.c
Examining data/rauc-1.4/src/checksum.c
Examining data/rauc-1.4/src/config_file.c
Examining data/rauc-1.4/src/context.c
Examining data/rauc-1.4/src/install.c
Examining data/rauc-1.4/src/manifest.c
Examining data/rauc-1.4/src/mark.c
Examining data/rauc-1.4/src/mbr.c
Examining data/rauc-1.4/src/mount.c
Examining data/rauc-1.4/src/service.c
Examining data/rauc-1.4/src/signature.c
Examining data/rauc-1.4/src/slot.c
Examining data/rauc-1.4/src/utils.c
Examining data/rauc-1.4/src/update_handler.c
Examining data/rauc-1.4/src/emmc.c
Examining data/rauc-1.4/src/network.c
Examining data/rauc-1.4/src/gpt.c
Examining data/rauc-1.4/src/main.c
Examining data/rauc-1.4/test/common.c
Examining data/rauc-1.4/test/common.h
Examining data/rauc-1.4/test/install-fixtures.c
Examining data/rauc-1.4/test/install-fixtures.h
Examining data/rauc-1.4/test/boot_switch.c
Examining data/rauc-1.4/test/bootchooser.c
Examining data/rauc-1.4/test/bundle.c
Examining data/rauc-1.4/test/checksum.c
Examining data/rauc-1.4/test/config_file.c
Examining data/rauc-1.4/test/context.c
Examining data/rauc-1.4/test/fakerand.c
Examining data/rauc-1.4/test/install.c
Examining data/rauc-1.4/test/manifest.c
Examining data/rauc-1.4/test/network.c
Examining data/rauc-1.4/test/progress.c
Examining data/rauc-1.4/test/service.c
Examining data/rauc-1.4/test/signature.c
Examining data/rauc-1.4/test/slot.c
Examining data/rauc-1.4/test/update_handler.c
Examining data/rauc-1.4/test/utils.c
Examining data/rauc-1.4/rauc-installer-generated.h
Examining data/rauc-1.4/contrib/cgi/src/cgi.c

FINAL RESULTS:

data/rauc-1.4/src/bundle.c:740:36:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
		ibundle->path = g_build_filename(g_get_tmp_dir(), "_download.raucb", NULL);
data/rauc-1.4/src/utils.c:262:10:  [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.
	rpath = realpath(path, buf);
data/rauc-1.4/test/bootchooser.c:533:50:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
	g_autofree gchar *state_path = g_build_filename(g_get_tmp_dir(), "uboot-test-state", NULL);
data/rauc-1.4/test/bootchooser.c:548:50:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
	g_autofree gchar *state_path = g_build_filename(g_get_tmp_dir(), "uboot-test-state", NULL);
data/rauc-1.4/test/bootchooser.c:846:50:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
	g_autofree gchar *state_path = g_build_filename(g_get_tmp_dir(), "custom-test-state", NULL);
data/rauc-1.4/test/bootchooser.c:859:50:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
	g_autofree gchar *state_path = g_build_filename(g_get_tmp_dir(), "custom-test-state", NULL);
data/rauc-1.4/test/common.c:23:20:  [3] (random) g_rand_int:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		str[i] = (gchar) g_rand_int(rand) & 0xFF;
data/rauc-1.4/src/bootchooser.c:760: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).
	*good = (atoi(attempts->str) > 0) ? TRUE : FALSE;
data/rauc-1.4/src/bootchooser.c:857:8:  [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).
			if (atoi(attempts->str) <= 0)
data/rauc-1.4/src/checksum.c:27: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(filename, O_RDONLY | O_CLOEXEC);
data/rauc-1.4/src/network.c:79: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 errbuf[CURL_ERROR_SIZE];
data/rauc-1.4/src/network.c:153: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).
	xfer.dl = fopen(target, "wbx");
data/rauc-1.4/src/signature.c:574: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 buf[BUFSIZ];
data/rauc-1.4/src/signature.c:600: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 md[SHA256_DIGEST_LENGTH];
data/rauc-1.4/src/signature.c:738: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[BUFSIZ];
data/rauc-1.4/src/update_handler.c:1309: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).
	out_fd = open(dest_slot->device, O_WRONLY);
data/rauc-1.4/src/update_handler.c:1424: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).
	out_fd = open(dest_slot->device, O_WRONLY);
data/rauc-1.4/test/fakerand.c:12: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("/dev/random", O_RDWR);
data/rauc-1.4/src/bootchooser.c:403:13:  [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(key_prefix);
data/rauc-1.4/src/bootchooser.c:404:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
			size = strlen(*variable);
data/rauc-1.4/src/bootchooser.c:683:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	offset = strlen(key) + 1;
data/rauc-1.4/src/bundle.c:576:53:  [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).
		g_autofree gchar *basepath = g_strndup(outbundle, strlen(outbundle) - 6);
data/rauc-1.4/src/bundle.c:764:30:  [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).
			strprfx = g_strndup(path, strlen(path) - 6);
data/rauc-1.4/src/checksum.c:34:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		r = read(fd, buf, sizeof(buf));
data/rauc-1.4/src/config_file.c:875: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).
		slotname = *group + strlen(RAUC_SLOT_PREFIX ".");
data/rauc-1.4/src/main.c:351:10:  [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).
		inpath[strlen(inpath)-1] = '\0';
data/rauc-1.4/src/mbr.c:141:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(fd, mbr, sizeof(*mbr)) != sizeof(*mbr)) {
data/rauc-1.4/src/network.c:117: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).
		size_t len = strlen(errbuf);
data/rauc-1.4/src/signature.c:413: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).
		load_capath = strlen(capath) ? capath : NULL;
data/rauc-1.4/src/signature.c:415: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).
		load_cadir = strlen(cadir) ? cadir : NULL;
data/rauc-1.4/src/update_handler.c:520: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(dest_slot->name) <= 16) {
data/rauc-1.4/src/update_handler.c:558: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(dest_slot->name) <= 16) {
data/rauc-1.4/src/utils.c:121: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).
	g_return_val_if_fail(strlen(path) > 1, FALSE);
data/rauc-1.4/src/utils.c:274: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(str);
data/rauc-1.4/src/utils.c:281: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).
	return strlen(str) != len;
data/rauc-1.4/test/boot_switch.c:87:11:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
	gboolean equal;
data/rauc-1.4/test/boot_switch.c:122:7:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
	if (!equal) {
data/rauc-1.4/test/boot_switch.c:127:16:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
	g_assert_true(equal);
data/rauc-1.4/test/boot_switch.c:137:32:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	stdin_buf = g_bytes_new(dump, strlen(dump));

ANALYSIS SUMMARY:

Hits = 39
Lines analyzed = 24386 in approximately 0.56 seconds (43898 lines/second)
Physical Source Lines of Code (SLOC) = 17631
Hits@level = [0]   2 [1]  21 [2]  11 [3]   7 [4]   0 [5]   0
Hits@level+ = [0+]  41 [1+]  39 [2+]  18 [3+]   7 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 2.32545 [1+] 2.21201 [2+] 1.02093 [3+] 0.397028 [4+]   0 [5+]   0
Dot directories skipped = 1 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.