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/lua-posix-33.4.0/ext/include/_helpers.c
Examining data/lua-posix-33.4.0/ext/include/compat-5.2.c
Examining data/lua-posix-33.4.0/ext/include/compat-5.2.h
Examining data/lua-posix-33.4.0/ext/include/strlcpy.c
Examining data/lua-posix-33.4.0/ext/posix/ctype.c
Examining data/lua-posix-33.4.0/ext/posix/dirent.c
Examining data/lua-posix-33.4.0/ext/posix/errno.c
Examining data/lua-posix-33.4.0/ext/posix/fcntl.c
Examining data/lua-posix-33.4.0/ext/posix/fnmatch.c
Examining data/lua-posix-33.4.0/ext/posix/getopt.c
Examining data/lua-posix-33.4.0/ext/posix/glob.c
Examining data/lua-posix-33.4.0/ext/posix/grp.c
Examining data/lua-posix-33.4.0/ext/posix/libgen.c
Examining data/lua-posix-33.4.0/ext/posix/poll.c
Examining data/lua-posix-33.4.0/ext/posix/pwd.c
Examining data/lua-posix-33.4.0/ext/posix/sched.c
Examining data/lua-posix-33.4.0/ext/posix/signal.c
Examining data/lua-posix-33.4.0/ext/posix/stdio.c
Examining data/lua-posix-33.4.0/ext/posix/stdlib.c
Examining data/lua-posix-33.4.0/ext/posix/sys/msg.c
Examining data/lua-posix-33.4.0/ext/posix/sys/resource.c
Examining data/lua-posix-33.4.0/ext/posix/sys/socket.c
Examining data/lua-posix-33.4.0/ext/posix/sys/stat.c
Examining data/lua-posix-33.4.0/ext/posix/sys/statvfs.c
Examining data/lua-posix-33.4.0/ext/posix/sys/time.c
Examining data/lua-posix-33.4.0/ext/posix/sys/times.c
Examining data/lua-posix-33.4.0/ext/posix/sys/utsname.c
Examining data/lua-posix-33.4.0/ext/posix/sys/wait.c
Examining data/lua-posix-33.4.0/ext/posix/syslog.c
Examining data/lua-posix-33.4.0/ext/posix/termio.c
Examining data/lua-posix-33.4.0/ext/posix/time.c
Examining data/lua-posix-33.4.0/ext/posix/utime.c
Examining data/lua-posix-33.4.0/ext/posix/posix.c
Examining data/lua-posix-33.4.0/ext/posix/unistd.c

FINAL RESULTS:

data/lua-posix-33.4.0/ext/posix/sys/stat.c:187:23:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	return pushresult(L, chmod(path, (mode_t) checkint(L, 2)), path);
data/lua-posix-33.4.0/ext/posix/unistd.c:171:23:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
	return pushresult(L, chown(path, uid, gid), path);
data/lua-posix-33.4.0/ext/posix/unistd.c:844:6:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	n = readlink(path, b, bufsiz);
data/lua-posix-33.4.0/ext/posix/libgen.c:48:29:  [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).
	lua_pushstring(L, basename(strcpy(b,path)));
data/lua-posix-33.4.0/ext/posix/libgen.c:75:28:  [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).
	lua_pushstring(L, dirname(strcpy(b,path)));
data/lua-posix-33.4.0/ext/posix/stdlib.c:129: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(tmppath, path);
data/lua-posix-33.4.0/ext/posix/stdlib.c:167: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(tmppath, path);
data/lua-posix-33.4.0/ext/posix/unistd.c:110:23:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	return pushresult(L, access(path, mode), path);
data/lua-posix-33.4.0/ext/posix/unistd.c:224:6:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
	r = crypt(str, salt);
data/lua-posix-33.4.0/ext/posix/unistd.c:306:15:  [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.
	(use_shell ? execvp : execv) (path, argv);
data/lua-posix-33.4.0/ext/posix/unistd.c:306:24:  [4] (shell) execv:
  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.
	(use_shell ? execvp : execv) (path, argv);
data/lua-posix-33.4.0/ext/posix/unistd.c:555:26:  [4] (misc) getlogin:
  It's often easy to fool getlogin. Sometimes it does not work at all,
  because some program messed up the utmp file. Often, it gives only the
  first 8 characters of the login name. The user currently logged in on the
  controlling tty of our program need not be the user who started it. Avoid
  getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid())
  and extract the desired information instead.
	return pushstringresult(getlogin());
data/lua-posix-33.4.0/ext/posix/getopt.c:47:8:  [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.
	ret = getopt_long(argc, argv,
data/lua-posix-33.4.0/ext/posix/stdlib.c:76: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.
		lua_pushstring(L, getenv(optstring(L, 1,
data/lua-posix-33.4.0/ext/posix/stdlib.c:244:11:  [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.
	if ((s = realpath(luaL_checkstring(L, 1), NULL)) == NULL)
data/lua-posix-33.4.0/ext/include/compat-5.2.c:621: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(newptr, B->ptr, B->nelems);
data/lua-posix-33.4.0/ext/include/compat-5.2.c:632: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(luaL_prepbuffsize(B, l), s, l);
data/lua-posix-33.4.0/ext/posix/fcntl.c:133:23:  [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).
	return pushresult(L, open(path, oflags, (mode_t) optint(L, 3, 511)), path);
data/lua-posix-33.4.0/ext/posix/stdio.c:33: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 b[L_ctermid];
data/lua-posix-33.4.0/ext/posix/stdlib.c:168:6:  [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).
	r = mkstemp(tmppath);
data/lua-posix-33.4.0/ext/posix/stdlib.c:200:23:  [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).
	return pushresult(L, open("/dev/ptmx", flags), NULL);
data/lua-posix-33.4.0/ext/posix/sys/msg.c:73: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 mtext[0];
data/lua-posix-33.4.0/ext/posix/sys/msg.c:92: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(msg->mtext, msgp, len);
data/lua-posix-33.4.0/ext/posix/sys/msg.c:130: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 mtext[0];
data/lua-posix-33.4.0/ext/posix/sys/socket.c:78: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 addr[INET6_ADDRSTRLEN];
data/lua-posix-33.4.0/ext/posix/sys/socket.c:242: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(sau->sun_path, path, len);
data/lua-posix-33.4.0/ext/posix/time.c:267: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/lua-posix-33.4.0/ext/include/compat-5.2.h:132: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).
  luaL_addlstring(B, s, strlen(s))
data/lua-posix-33.4.0/ext/posix/libgen.c:44: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).
	path_len = strlen(path) + 1;
data/lua-posix-33.4.0/ext/posix/libgen.c:71: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).
	path_len = strlen(path) + 1;
data/lua-posix-33.4.0/ext/posix/stdlib.c:119: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).
	size_t path_len = strlen(path) + 1;
data/lua-posix-33.4.0/ext/posix/stdlib.c:157: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).
	size_t path_len = strlen(path) + 1;
data/lua-posix-33.4.0/ext/posix/sys/stat.c:287:23:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	return pushintresult(umask((mode_t) checkint(L, 1)));
data/lua-posix-33.4.0/ext/posix/unistd.c:220: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(salt) < 2)
data/lua-posix-33.4.0/ext/posix/unistd.c:793:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(fd, buf, count);

ANALYSIS SUMMARY:

Hits = 35
Lines analyzed = 9217 in approximately 0.27 seconds (34472 lines/second)
Physical Source Lines of Code (SLOC) = 5111
Hits@level = [0]   4 [1]   8 [2]  12 [3]   3 [4]   9 [5]   3
Hits@level+ = [0+]  39 [1+]  35 [2+]  27 [3+]  15 [4+]  12 [5+]   3
Hits/KSLOC@level+ = [0+] 7.6306 [1+] 6.84797 [2+] 5.28272 [3+] 2.93485 [4+] 2.34788 [5+] 0.586969
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.