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/libirecovery-1.0.0/include/libirecovery.h
Examining data/libirecovery-1.0.0/src/libirecovery.c
Examining data/libirecovery-1.0.0/src/thread.c
Examining data/libirecovery-1.0.0/src/thread.h
Examining data/libirecovery-1.0.0/src/utils.c
Examining data/libirecovery-1.0.0/src/utils.h
Examining data/libirecovery-1.0.0/tools/irecovery.c

FINAL RESULTS:

data/libirecovery-1.0.0/src/libirecovery.c:108:43:  [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(...) if(libirecovery_debug) fprintf(stderr, __VA_ARGS__)
data/libirecovery-1.0.0/src/libirecovery.c:523:3:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
		sscanf(ptr, "ECID:%" SCNx64, &client->device_info.ecid);
data/libirecovery-1.0.0/src/libirecovery.c:535:3:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
		sscanf(ptr, "SRNM:[%s]", tmp);
data/libirecovery-1.0.0/src/libirecovery.c:546:3:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
		sscanf(ptr, "IMEI:[%s]", tmp);
data/libirecovery-1.0.0/src/libirecovery.c:557:3:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
		sscanf(ptr, "SRTG:[%s]", tmp);
data/libirecovery-1.0.0/src/libirecovery.c:725:15:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
			if (!p || (sscanf(p, "\\usb#vid_%*04x&pid_%*04x#%s", serial_str) != 1) || (serial_str[0] == '\0')) {
data/libirecovery-1.0.0/src/libirecovery.c:807:15:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
			if (!p || (sscanf(p, "\\usb#vid_%*04x&pid_%*04x#%s", serial_str) != 1) || (serial_str[0] == '\0')) {
data/libirecovery-1.0.0/src/libirecovery.c:1830:13:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	if (!p || (sscanf(p, "\\usb#vid_%*04x&pid_%04x#%s", &pid, serial_str) != 2) || (serial_str[0] == '\0')) {
data/libirecovery-1.0.0/src/libirecovery.c:3162: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(model, hardware_model);
data/libirecovery-1.0.0/tools/irecovery.c:46:32:  [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(...) if(verbose) fprintf(stderr, __VA_ARGS__)
data/libirecovery-1.0.0/src/libirecovery.c:337:17:  [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.
	char* dbglvl = getenv("LIBIRECOVERY_DEBUG_LEVEL");
data/libirecovery-1.0.0/src/thread.c:93:2:  [3] (misc) InitializeCriticalSection:
  Exceptions can be thrown in low-memory situations. Use
  InitializeCriticalSectionAndSpinCount instead.
	InitializeCriticalSection(mutex);
data/libirecovery-1.0.0/src/thread.c:111:2:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
	EnterCriticalSection(mutex);
data/libirecovery-1.0.0/tools/irecovery.c:415: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, "i:vVhrsmnc:f:e:k:q", longopts, NULL)) > 0) {
data/libirecovery-1.0.0/src/libirecovery.c:404: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 descriptor[256];
data/libirecovery-1.0.0/src/libirecovery.c:458: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 data[255];
data/libirecovery-1.0.0/src/libirecovery.c:531: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 tmp[256];
data/libirecovery-1.0.0/src/libirecovery.c:572: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[255];
data/libirecovery-1.0.0/src/libirecovery.c:693: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((void*) result, details->DevicePath, requiredSize - sizeof(DWORD));
data/libirecovery-1.0.0/src/libirecovery.c:717: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 serial_str[256];
data/libirecovery-1.0.0/src/libirecovery.c:784: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((void*) result, details->DevicePath, requiredSize - sizeof(DWORD));
data/libirecovery-1.0.0/src/libirecovery.c:799: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 serial_str[256];
data/libirecovery-1.0.0/src/libirecovery.c:990: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(packet->data, data, w_length);
data/libirecovery-1.0.0/src/libirecovery.c:1008: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(data, packet->data, count);
data/libirecovery-1.0.0/src/libirecovery.c:1132: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 serial_str[256];
data/libirecovery-1.0.0/src/libirecovery.c:1369: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 serial_str[256];
data/libirecovery-1.0.0/src/libirecovery.c:1811: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 serial_str[256];
data/libirecovery-1.0.0/src/libirecovery.c:1924: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(&(usb_dev_info->device_info), &(client_loc.device_info), sizeof(struct irecv_device_info));
data/libirecovery-1.0.0/src/libirecovery.c:2104: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 driver[256];
data/libirecovery-1.0.0/src/libirecovery.c:2492: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(filename, "rb");
data/libirecovery-1.0.0/src/libirecovery.c:2531: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 buffer[6];
data/libirecovery-1.0.0/src/libirecovery.c:2555: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 dfu_xbuf[12] = {0xff, 0xff, 0xff, 0xff, 0xac, 0x05, 0x00, 0x01, 0x55, 0x46, 0x44, 0x10};
data/libirecovery-1.0.0/src/libirecovery.c:2633:6:  [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(newbuf, &buffer[i * packet_size], size);
data/libirecovery-1.0.0/src/libirecovery.c:2635: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(newbuf+size, dfu_xbuf, 12);
data/libirecovery-1.0.0/src/libirecovery.c:2715: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[BUFFER_SIZE];
data/libirecovery-1.0.0/src/libirecovery.c:2749: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 command[256];
data/libirecovery-1.0.0/src/libirecovery.c:2949: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 command[256];
data/libirecovery-1.0.0/src/libirecovery.c:3161:2:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	char model[8];
data/libirecovery-1.0.0/src/utils.c:91:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy(dest->list, src->list, sizeof(void*) * src->capacity);
data/libirecovery-1.0.0/tools/irecovery.c:105:6:  [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(filename, "rb");
data/libirecovery-1.0.0/src/libirecovery.c:586:15:  [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).
	int taglen = strlen(tag);
data/libirecovery-1.0.0/src/libirecovery.c:602:12:  [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).
				nlen = strlen(p);
data/libirecovery-1.0.0/src/libirecovery.c:718: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).
			char *p = result + strlen(result) - 1;
data/libirecovery-1.0.0/src/libirecovery.c:736: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).
			for (j = 0; j < strlen(serial_str); j++) {
data/libirecovery-1.0.0/src/libirecovery.c:800: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).
			char *p = result + strlen(result) - 1;
data/libirecovery-1.0.0/src/libirecovery.c:818: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).
			for (j = 0; j < strlen(serial_str); j++) {
data/libirecovery-1.0.0/src/libirecovery.c:1822:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	char *p = result + strlen(result) - 1;
data/libirecovery-1.0.0/src/libirecovery.c:1844: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).
	for (j = 0; j < strlen(serial_str); j++) {
data/libirecovery-1.0.0/src/libirecovery.c:2201: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/libirecovery-1.0.0/src/libirecovery.c:2256: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(500000);
data/libirecovery-1.0.0/src/libirecovery.c:2428:24:  [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).
	unsigned int length = strlen(command);
data/libirecovery-1.0.0/src/libirecovery.c:2450:24:  [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).
	unsigned int length = strlen(command);
data/libirecovery-1.0.0/src/libirecovery.c:2878: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(5 * 1000);

ANALYSIS SUMMARY:

Hits = 53
Lines analyzed = 4368 in approximately 0.16 seconds (26967 lines/second)
Physical Source Lines of Code (SLOC) = 3592
Hits@level = [0]  79 [1]  13 [2]  26 [3]   4 [4]  10 [5]   0
Hits@level+ = [0+] 132 [1+]  53 [2+]  40 [3+]  14 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 36.7483 [1+] 14.755 [2+] 11.1359 [3+] 3.89755 [4+] 2.78396 [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.