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/gsm0710muxd-1.13/src/muxercontrol.c
Examining data/gsm0710muxd-1.13/src/muxercontrol.h
Examining data/gsm0710muxd-1.13/src/gsm0710muxd.c

FINAL RESULTS:

data/gsm0710muxd-1.13/src/gsm0710muxd.c:381:3:  [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(buffer, prefix);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1886: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, "dvs:t:p:f:h?m:b:B:P:a:x:l:")) > 0)
data/gsm0710muxd-1.13/src/gsm0710muxd.c:140: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[GSM0710_BUFFER_SIZE];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:147: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 adv_data[GSM0710_BUFFER_SIZE];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:375: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[100];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:412: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 fn[256];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:416:17:  [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).
		SYSCHECK(fd = open(fn, O_RDWR | O_NONBLOCK));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:447: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 prefix[5] = { GSM0710_FRAME_FLAG, GSM0710_EA | GSM0710_CR, 0, 0, 0 };
data/gsm0710muxd-1.13/src/gsm0710muxd.c:448: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 postfix[2] = { 0xFF, GSM0710_FRAME_FLAG };
data/gsm0710muxd-1.13/src/gsm0710muxd.c:662: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.
		unsigned char buf[4096];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:677: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(buf, channel->tmp, channel->remaining);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:687: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(channel->tmp, buf + sizeof(buf) - channel->remaining, channel->remaining);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:754:34:  [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).
				SYSCHECK(channellist[i].fd = open(channellist[i].devicename, O_RDWR | O_NONBLOCK)); //open devices
data/gsm0710muxd-1.13/src/gsm0710muxd.c:839:15:  [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).
			tuple[1] = atoi(str + pos);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:846:12:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			first = atoi(str + pos);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:903:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(buf->writep, input, c);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:904:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(buf->data, input + c, length - c);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:909:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(buf->writep, input, length);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1007: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(frame->data, data, end);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1008: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(frame->data + end, buf->data, frame->length - end);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1013: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(frame->data, data, frame->length);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1121: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(frame->data, data + 2, frame->length);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1216: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 buf[1024];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1608:13:  [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 buf[4096];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1653:24:  [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).
	SYSCHECK(serial->fd = open(serial->devicename, O_RDWR | O_NOCTTY | O_NONBLOCK));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1690: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 gsm_command[100];
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1900:16:  [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).
			mylogfile = fopen(optarg, "w+");
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1907:18:  [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).
			use_timeout = atoi(optarg);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1910:15:  [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).
			use_ping = atoi(optarg);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1913:15:  [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).
			pin_code = atoi(optarg);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1917:14:  [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).
			cmux_N1 = atoi(optarg);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1928:31:  [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).
			additional_functionality = atoi(optarg);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1931: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).
			cmux_port_speed = baud_rate_index(atoi(optarg));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1934:36:  [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).
			at_port_speed = baud_rate_index(atoi(optarg));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:382: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).
		off = strlen(buffer);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:384: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).
		off = strlen(buffer);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:391: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).
			off = strlen(buffer);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:394: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).
		off = strlen(buffer);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:399: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).
				off = strlen(buffer);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:664:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		int len = read(channel->fd, buf + channel->remaining, sizeof(buf) - channel->remaining);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1220:43:  [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).
	syslogdump(">s ", (unsigned char *) cmd, strlen(cmd));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1221:51:  [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).
	SYSCHECK(wrote = write(serial_device_fd, WAKEUP, strlen(WAKEUP)));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1222: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(50);
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1223:48:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	SYSCHECK(wrote = write(serial_device_fd, cmd, strlen(cmd)));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1240:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			len = read(serial_device_fd, buf, sizeof(buf));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1614:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			&& (len = read(serial->fd, buf, min(length, sizeof(buf)))) > 0)
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1780: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).
		syslogdump(">s ", (unsigned char *)poff, strlen(poff));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1781:26:  [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).
		write(serial.fd, poff, strlen(poff));
data/gsm0710muxd-1.13/src/gsm0710muxd.c:1951:2:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	umask(0);

ANALYSIS SUMMARY:

Hits = 49
Lines analyzed = 2368 in approximately 0.11 seconds (22190 lines/second)
Physical Source Lines of Code (SLOC) = 1915
Hits@level = [0]  29 [1]  15 [2]  32 [3]   1 [4]   1 [5]   0
Hits@level+ = [0+]  78 [1+]  49 [2+]  34 [3+]   2 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 40.7311 [1+] 25.5875 [2+] 17.7546 [3+] 1.04439 [4+] 0.522193 [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.