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/modglue-1.17/examples/multi_io.cc
Examining data/modglue-1.17/examples/periodic.cc
Examining data/modglue-1.17/examples/periodic_modglue.cc
Examining data/modglue-1.17/examples/use_wget.cc
Examining data/modglue-1.17/src/ext_process.cc
Examining data/modglue-1.17/src/gtkiowin.cc
Examining data/modglue-1.17/src/gtkshell.cc
Examining data/modglue-1.17/src/gtkshell2.cc
Examining data/modglue-1.17/src/isatty.cc
Examining data/modglue-1.17/src/main.cc
Examining data/modglue-1.17/src/mid.cc
Examining data/modglue-1.17/src/modshell.cc
Examining data/modglue-1.17/src/modwrap.cc
Examining data/modglue-1.17/src/process.cc
Examining data/modglue-1.17/src/ptywrap.cc
Examining data/modglue-1.17/src/shell.cc
Examining data/modglue-1.17/src/test_child_process.cc
Examining data/modglue-1.17/src/test_ext_process.cc
Examining data/modglue-1.17/src/test_pipe.cc
Examining data/modglue-1.17/src/test_pipe_gtk.cc
Examining data/modglue-1.17/src/test_writes.cc
Examining data/modglue-1.17/src/prompt.cc
Examining data/modglue-1.17/src/pipe.cc

FINAL RESULTS:

data/modglue-1.17/src/ext_process.cc:185:4:  [4] (shell) execvp:
  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.
			execvp(name_.c_str(), const_cast<char *const *>(cargs));
data/modglue-1.17/src/modwrap.cc:116:4:  [4] (shell) execvp:
  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.
			execvp(argv[1],&(argv[1]));
data/modglue-1.17/src/process.cc:187:4:  [4] (shell) execvp:
  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.
			execvp(name.c_str(), const_cast<char *const *>(cargs));
data/modglue-1.17/src/ptywrap.cc:306:4:  [4] (shell) execvp:
  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.
			execvp(argv[1],&(argv[1]));
data/modglue-1.17/src/ext_process.cc:281:4:  [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.
			realpath(full_path_.substr(0,full_path_.size()-1).c_str(), realpth);
data/modglue-1.17/examples/periodic.cc:30: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/modglue-1.17/examples/periodic.cc:38:4:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
			sprintf(buffer, "test %d", counter);
data/modglue-1.17/examples/periodic_modglue.cc:39: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 buffer[100];
data/modglue-1.17/examples/periodic_modglue.cc:42:4:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
			sprintf(buffer, "test %d\n", counter);
data/modglue-1.17/src/ext_process.cc:146:10:  [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.
   const char *cargs[realargs.size()+2];
data/modglue-1.17/src/ext_process.cc:280: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 realpth[MAXPATHLEN];
data/modglue-1.17/src/ext_process.cc:318: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 pipename[100];
data/modglue-1.17/src/ext_process.cc:319: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 iotype[100];
data/modglue-1.17/src/ext_process.cc:342:20:  [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).
		input_pipes_[i]->open();
data/modglue-1.17/src/ext_process.cc:345: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).
		output_pipes_[i]->open();
data/modglue-1.17/src/gtkshell.cc:650: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/modglue-1.17/src/gtkshell2.cc:650: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/modglue-1.17/src/main.cc:92: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/modglue-1.17/src/main.cc:97:4:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
			sprintf(buffer, "waitpid failed, errno = %d", errno);
data/modglue-1.17/src/main.cc:105:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
		sprintf(buffer, "%ld %d", (long)childpid, child_val);
data/modglue-1.17/src/main.cc:110:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
		sprintf(buffer, "%ld", (long)childpid);
data/modglue-1.17/src/main.cc:145:16:  [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    fd  =atoi(argbit.substr(pos+1).c_str());
data/modglue-1.17/src/main.cc:163:8:  [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).
				p->open(1);
data/modglue-1.17/src/main.cc:167:8:  [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).
				p->open(2);
data/modglue-1.17/src/main.cc:171:8:  [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).
				p->open(default_fd);
data/modglue-1.17/src/main.cc:175: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).
		else p->open((*it).second);
data/modglue-1.17/src/main.cc:187:8:  [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).
				p->open(0);
data/modglue-1.17/src/main.cc:197:8:  [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).
				p->open(default_fd);
data/modglue-1.17/src/main.cc:201: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).
		else p->open((*it).second);
data/modglue-1.17/src/main.cc:278: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 buffer[1024];
data/modglue-1.17/src/modwrap.cc:130: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[1024];
data/modglue-1.17/src/pipe.cc:79: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).
void modglue::pipe::open(int fd, int fd_external)
data/modglue-1.17/src/pipe.cc:187: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 cbuf[CMSG_SPACE(sizeof(int))]; 
data/modglue-1.17/src/pipe.cc:299: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(i_buf + (putbackarea - numPutback), gptr() - numPutback, numPutback);    
data/modglue-1.17/src/process.cc:84: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[1024];
data/modglue-1.17/src/process.cc:128: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[2];
data/modglue-1.17/src/process.cc:150:10:  [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.
   const char *cargs[args.size()+2];
data/modglue-1.17/src/prompt.cc: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 buffer[1024];
data/modglue-1.17/src/prompt.cc:364: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[1024];
data/modglue-1.17/src/prompt.cc:379: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[1024];
data/modglue-1.17/src/ptywrap.cc:75:8:  [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).
	mfd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
data/modglue-1.17/src/ptywrap.cc:85:13:  [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).
	if ((sfd = open(slave, O_RDONLY | O_NOCTTY)) == -1)
data/modglue-1.17/src/ptywrap.cc:320: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[1024];
data/modglue-1.17/src/test_writes.cc:41: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 buffer[2024];
data/modglue-1.17/examples/periodic.cc:34:25:  [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(write(1, argv[1], strlen(argv[1]))<strlen(argv[1]))
data/modglue-1.17/examples/periodic.cc:34:42:  [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(write(1, argv[1], strlen(argv[1]))<strlen(argv[1]))
data/modglue-1.17/examples/periodic.cc:39: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).
			if(write(1, buffer, strlen(buffer))<strlen(buffer))
data/modglue-1.17/examples/periodic.cc:39:40:  [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(write(1, buffer, strlen(buffer))<strlen(buffer))
data/modglue-1.17/src/ext_process.cc:307: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).
			if(hit==strlen(comp)) {
data/modglue-1.17/src/ext_process.cc:323:6:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		if(sscanf(line.c_str(), "{ %99s , %99s }\n", pipename, iotype)==2) {
data/modglue-1.17/src/gtkshell.cc:651:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(fd, buffer, 99);
data/modglue-1.17/src/gtkshell2.cc:651:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(fd, buffer, 99);
data/modglue-1.17/src/main.cc:106:42:  [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(main::sig_chld_pipe_[1], buffer, strlen(buffer));
data/modglue-1.17/src/main.cc:111:42:  [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(main::sig_chld_pipe_[1], buffer, strlen(buffer));
data/modglue-1.17/src/main.cc:281:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			pos=read(fd,buffer,1023-1);
data/modglue-1.17/src/modwrap.cc:147:4:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			read(sig_chld_pipe[0],buffer,1);
data/modglue-1.17/src/modwrap.cc:152:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(0,buffer,1023);
data/modglue-1.17/src/modwrap.cc:159:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(p_stdout.first,buffer,1023);
data/modglue-1.17/src/modwrap.cc:166:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(p_stderr.first,buffer,1023);
data/modglue-1.17/src/modwrap.cc:175:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while((length=read(p_stdout.first,buffer,1023))>0) {
data/modglue-1.17/src/modwrap.cc:179:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while((length=read(p_stderr.first,buffer,1023))>0) {
data/modglue-1.17/src/pipe.cc:181:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ret=read(fd_, data, maxlen);
data/modglue-1.17/src/process.cc:87:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while((pos=::read(pipes[1].parent_fd, buffer, 1023))>0) {
data/modglue-1.17/src/process.cc:94:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while((pos=::read(pipes[2].parent_fd, buffer, 1023))>0) {
data/modglue-1.17/src/process.cc:125:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
void child_process::read(std::string& str) 
data/modglue-1.17/src/process.cc:129:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while((pos=::read(pipes[1].parent_fd, buffer, 1))>0) {
data/modglue-1.17/src/process.cc:135:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
ssize_t child_process::read(void *buffer, size_t len) 
data/modglue-1.17/src/process.cc:137:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return ::read(pipes[1].parent_fd, buffer, len);
data/modglue-1.17/src/prompt.cc:323:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		p.read(buffer,1023);
data/modglue-1.17/src/prompt.cc:367:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		p.read(buffer,1016);
data/modglue-1.17/src/prompt.cc:382:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		p.read(buffer,1016);
data/modglue-1.17/src/ptywrap.cc:321:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(sig_chld_pipe[0], buffer, 1); // wait until child is ready
data/modglue-1.17/src/ptywrap.cc:338:4:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			read(sig_chld_pipe[0],buffer,1);
data/modglue-1.17/src/ptywrap.cc:343:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(0,buffer,1023);
data/modglue-1.17/src/ptywrap.cc:351:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(p_stdout.first,buffer,1023);
data/modglue-1.17/src/ptywrap.cc:360:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int length=read(p_stderr.first,buffer,1023);
data/modglue-1.17/src/ptywrap.cc:371:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while((length=read(p_stdout.first,buffer,1023))>0) {
data/modglue-1.17/src/ptywrap.cc:375:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while((length=read(p_stderr.first,buffer,1023))>0) {
data/modglue-1.17/src/test_writes.cc:44:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			inp.read(buffer, 2023);

ANALYSIS SUMMARY:

Hits = 79
Lines analyzed = 5341 in approximately 0.16 seconds (32789 lines/second)
Physical Source Lines of Code (SLOC) = 3703
Hits@level = [0]   2 [1]  35 [2]  39 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+]  81 [1+]  79 [2+]  44 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 21.8742 [1+] 21.3341 [2+] 11.8823 [3+] 1.35026 [4+] 1.08021 [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.