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/libpam-x2go-0.0.2.0/include/pam-x2go.h
Examining data/libpam-x2go-0.0.2.0/src/auth-check-path.c
Examining data/libpam-x2go-0.0.2.0/src/auth-check-path.h
Examining data/libpam-x2go-0.0.2.0/src/pam-x2go.c
Examining data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c
Examining data/libpam-x2go-0.0.2.0/src/pam-x2go-children.h
Examining data/libpam-x2go-0.0.2.0/src/pam-x2go-private.h
Examining data/libpam-x2go-0.0.2.0/src/x2go-auth-check.c
Examining data/libpam-x2go-0.0.2.0/tests/mock_guest.c
Examining data/libpam-x2go-0.0.2.0/tests/mock_guest.h
Examining data/libpam-x2go-0.0.2.0/tests/mock_pam.c
Examining data/libpam-x2go-0.0.2.0/tests/mock_pam.h
Examining data/libpam-x2go-0.0.2.0/tests/test-x2go-auth.c
Examining data/libpam-x2go-0.0.2.0/tests/test-x2go-wrapper.cc

FINAL RESULTS:

data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:188:6:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	if (chmod(socket_addr.sun_path, S_IRUSR | S_IWUSR) != 0 ||
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:189:4:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
			chown(socket_addr.sun_path, pwdent->pw_uid, pwdent->pw_gid) != 0) {
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:53:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
int chmod(const char *path, mode_t mode)
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:56:5:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
int chown(const char *path, uid_t owner, gid_t group)
data/libpam-x2go-0.0.2.0/tests/mock_guest.h:23:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
int chmod(const char *path, mode_t mode);
data/libpam-x2go-0.0.2.0/tests/mock_guest.h:24:5:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
int chown(const char *path, uid_t owner, gid_t group);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:82:2:  [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(args[0], args);
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:59:5:  [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.
int execvp(const char *file, char *const argv[])
data/libpam-x2go-0.0.2.0/tests/mock_guest.h:25:5:  [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.
int execvp(const char *file, char *const argv[]);
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:82:22:  [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.
	const char * home = getenv("HOME");
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:48: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 * args[5];
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:339: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 readbuffer[strlen(ALL_GOOD_SIGNAL) + 1];
data/libpam-x2go-0.0.2.0/src/x2go-auth-check.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 password[512];
data/libpam-x2go-0.0.2.0/src/x2go-auth-check.c:59: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 *array[2];
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:104: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 + 2];
data/libpam-x2go-0.0.2.0/tests/mock_pam.c:106: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(tmp, value, nsize);
data/libpam-x2go-0.0.2.0/tests/test-x2go-auth.c:28: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 password[512];
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:137: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).
	buffer_len += strlen(ruser) + 1;    /* Add one for the space */
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:138: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).
	buffer_len += strlen(rhost) + 1;    /* Add one for the space */
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:139: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).
	buffer_len += strlen(rcommand) + 1;  /* Add one for the space */
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:140: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).
	buffer_len += strlen(password) + 1; /* Add one for the NULL */
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:176:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(socket_addr.sun_path, pwdent->pw_dir, sizeof(socket_addr.sun_path) - 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:177:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
	strncpy(socket_addr.sun_path + strlen(pwdent->pw_dir), "/.x2go-socket", (sizeof(socket_addr.sun_path) - strlen(pwdent->pw_dir)) - 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:177:33:  [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).
	strncpy(socket_addr.sun_path + strlen(pwdent->pw_dir), "/.x2go-socket", (sizeof(socket_addr.sun_path) - strlen(pwdent->pw_dir)) - 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:177:106:  [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).
	strncpy(socket_addr.sun_path + strlen(pwdent->pw_dir), "/.x2go-socket", (sizeof(socket_addr.sun_path) - strlen(pwdent->pw_dir)) - 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:197:49:  [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).
	readywrite = write(readypipe, ALL_GOOD_SIGNAL, strlen(ALL_GOOD_SIGNAL) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go-children.c:198: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).
	if (readywrite != strlen(ALL_GOOD_SIGNAL) + 1) {
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:136: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 (mlock(promptval, strlen(promptval) + 1) != 0) {
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:146:29:  [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 * newish = subloc + strlen("://");
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:194: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).
				memset(global_password, 0, strlen(global_password));
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:195: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).
				munlock(global_password, strlen(global_password) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:199:31:  [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 (mlock(global_password, strlen(global_password) + 1) != 0) {
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:209: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).
			memset(promptval, 0, strlen(promptval) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:210: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).
			munlock(promptval, strlen(promptval) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:266:46:  [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).
			bytesout += write(stdinpipe[1], password, strlen(password));
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:339:19:  [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 readbuffer[strlen(ALL_GOOD_SIGNAL) + 1];
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:342:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		readlen = read(sessionready[0], readbuffer, strlen(ALL_GOOD_SIGNAL) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:342:47:  [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).
		readlen = read(sessionready[0], readbuffer, strlen(ALL_GOOD_SIGNAL) + 1);
data/libpam-x2go-0.0.2.0/src/pam-x2go.c:346: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).
		if (readlen == strlen(ALL_GOOD_SIGNAL) + 1) {
data/libpam-x2go-0.0.2.0/src/x2go-auth-check.c:39:6:  [1] (buffer) scanf:
  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 (scanf("%511s", password) != 1) {
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:94: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).
	servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
data/libpam-x2go-0.0.2.0/tests/mock_guest.c:108:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	in = read(socket_fd, buffer, BUFFER_SIZE);
data/libpam-x2go-0.0.2.0/tests/mock_pam.c:94: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).
		osize = strlen((const char *)*slot) + 1;
data/libpam-x2go-0.0.2.0/tests/mock_pam.c:96: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).
		nsize = strlen((const char *)value) + 1;
data/libpam-x2go-0.0.2.0/tests/test-x2go-auth.c:34:6:  [1] (buffer) scanf:
  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 (scanf("%511s", password) != 1) {

ANALYSIS SUMMARY:

Hits = 45
Lines analyzed = 1308 in approximately 0.07 seconds (17462 lines/second)
Physical Source Lines of Code (SLOC) = 814
Hits@level = [0]   7 [1]  28 [2]   7 [3]   1 [4]   3 [5]   6
Hits@level+ = [0+]  52 [1+]  45 [2+]  17 [3+]  10 [4+]   9 [5+]   6
Hits/KSLOC@level+ = [0+] 63.8821 [1+] 55.2826 [2+] 20.8845 [3+] 12.285 [4+] 11.0565 [5+] 7.37101
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.