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/xinit-1.4.0/xinit.c
Examining data/xinit-1.4.0/startx.cpp
Examining data/xinit-1.4.0/launchd/console_redirect.c
Examining data/xinit-1.4.0/launchd/privileged_startx/20-font_cache.cpp
Examining data/xinit-1.4.0/launchd/privileged_startx/privileged_startx.plist.cpp
Examining data/xinit-1.4.0/launchd/privileged_startx/client.c
Examining data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp
Examining data/xinit-1.4.0/launchd/privileged_startx/privileged_startx_types.h
Examining data/xinit-1.4.0/launchd/privileged_startx/privileged_startx.c
Examining data/xinit-1.4.0/launchd/privileged_startx/server.c
Examining data/xinit-1.4.0/launchd/user_startx/startx.plist.cpp
Examining data/xinit-1.4.0/launchd/user_startx/launchd_startx.c
Examining data/xinit-1.4.0/launchd/console_redirect.h
Examining data/xinit-1.4.0/xinitrc.cpp

FINAL RESULTS:

data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:58:4:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
			chmod 1777 $dir
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:59: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 root:wheel $dir
data/xinit-1.4.0/launchd/console_redirect.c:409:5:  [4] (shell) system:
  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.
    system("/bin/echo SYST OUT");
data/xinit-1.4.0/launchd/console_redirect.c:410:5:  [4] (shell) system:
  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.
    system("/bin/echo SYST ERR >&2");
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:31:20:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
XCOMM Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:32:15:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
XCOMM get BSD mktemp
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:33:18:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
if [ -x /usr/bin/mktemp ] ; then
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:34:21:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
    MKTEMP=/usr/bin/mktemp
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:36:12:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
    MKTEMP=mktemp
data/xinit-1.4.0/launchd/privileged_startx/10-tmpdirs.cpp:54:9:  [4] (tmpfile) mktemp:
  Temporary file race condition (CWE-377).
		# Use mktemp rather than mkdir to avoid possible security issue
data/xinit-1.4.0/launchd/privileged_startx/server.c:281:13:  [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(s, ftsent->fts_name);
data/xinit-1.4.0/launchd/privileged_startx/server.c:284:26:  [4] (shell) system:
  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.
            error_code = system(fn_buf);
data/xinit-1.4.0/startx.cpp:6:19:  [4] (shell) system:
  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.
XCOMM files, then system xinitrc and xserverrc files, else lets xinit choose
data/xinit-1.4.0/startx.cpp:7:25:  [4] (shell) system:
  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.
XCOMM its default.  The system xinitrc should probably do things like check
data/xinit-1.4.0/startx.cpp:23:20:  [4] (shell) system:
  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.
XCOMM the standard system path at the back, since if you are using the Xorg
data/xinit-1.4.0/xinit.c:137: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.
    execvp(vec[0], vec);
data/xinit-1.4.0/xinit.c:138:9:  [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.
    if (access(vec[0], R_OK) == 0) {
data/xinit-1.4.0/xinit.c:141: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(vec[0], vec);
data/xinit-1.4.0/xinit.c:227:17:  [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.
            if (access(xinitrcbuf, F_OK) == 0) {
data/xinit-1.4.0/xinit.c:253:17:  [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.
            if (access(xserverrcbuf, F_OK) == 0) {
data/xinit-1.4.0/xinit.c:637:13:  [4] (shell) execlp:
  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.
            execlp ("kbd_mode", "kbd_mode", "-a", NULL);
data/xinit-1.4.0/xinit.c:664:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, fmt, ap);
data/xinit-1.4.0/xinit.c:672:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, fmt, ap);
data/xinit-1.4.0/xinit.c:219:19:  [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.
        if ((cp = getenv("XINITRC")) != NULL) {
data/xinit-1.4.0/xinit.c:222:26:  [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.
        } else if ((cp = getenv("HOME")) != NULL) {
data/xinit-1.4.0/xinit.c:245:19:  [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.
        if ((cp = getenv("XSERVERRC")) != NULL) {
data/xinit-1.4.0/xinit.c:248:26:  [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.
        } else if ((cp = getenv("HOME")) != NULL) {
data/xinit-1.4.0/xinit.c:535:18:  [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.
    windowpath = getenv("WINDOWPATH");
data/xinit-1.4.0/launchd/privileged_startx/server.c:228: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 fn_buf[PATH_MAX + 1];
data/xinit-1.4.0/launchd/privileged_startx/server.c:234: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.
    const char * path_argv[2] = {script_dir, NULL};
data/xinit-1.4.0/xinit.c:83:1:  [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 xinitrcbuf[256];
data/xinit-1.4.0/xinit.c:88:1:  [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 xserverrcbuf[256];
data/xinit-1.4.0/xinit.c:96:8:  [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.
static char *serverargv[100];
data/xinit-1.4.0/xinit.c:97:8:  [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.
static char *clientargv[100];
data/xinit-1.4.0/xinit.c:490: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 nums[10];
data/xinit-1.4.0/launchd/console_redirect.c:102:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while((nbytes = read(fd, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
data/xinit-1.4.0/launchd/privileged_startx/server.c:269:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(fn_buf, script_dir, PATH_MAX-1);
data/xinit-1.4.0/launchd/privileged_startx/server.c:270:5:  [1] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant character.
    strcat(fn_buf, "/");
data/xinit-1.4.0/startx.cpp:71:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
if ! defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
data/xinit-1.4.0/startx.cpp:75:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
if ! defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
data/xinit-1.4.0/startx.cpp:79:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
data/xinit-1.4.0/startx.cpp:83:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
if ! defaults read $X11_PREFS_DOMAIN enable_iglx > /dev/null 2>&1 ; then
data/xinit-1.4.0/startx.cpp:88:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
if [ x`defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
data/xinit-1.4.0/xinit.c:544: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).
        len = strlen(windowpath) + 1 + numn + 1;

ANALYSIS SUMMARY:

Hits = 44
Lines analyzed = 2271 in approximately 0.07 seconds (32136 lines/second)
Physical Source Lines of Code (SLOC) = 1500
Hits@level = [0]  37 [1]   9 [2]   7 [3]   5 [4]  21 [5]   2
Hits@level+ = [0+]  81 [1+]  44 [2+]  35 [3+]  28 [4+]  23 [5+]   2
Hits/KSLOC@level+ = [0+]  54 [1+] 29.3333 [2+] 23.3333 [3+] 18.6667 [4+] 15.3333 [5+] 1.33333
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.