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/kdesu-5.74.0/autotests/kdesutest.cpp
Examining data/kdesu-5.74.0/src/defaults.h
Examining data/kdesu-5.74.0/src/kcookie.cpp
Examining data/kdesu-5.74.0/src/client.h
Examining data/kdesu-5.74.0/src/kdesu_stub.c
Examining data/kdesu-5.74.0/src/stubprocess.h
Examining data/kdesu-5.74.0/src/stub.h
Examining data/kdesu-5.74.0/src/sshprocess.cpp
Examining data/kdesu-5.74.0/src/client.cpp
Examining data/kdesu-5.74.0/src/kcookie_p.h
Examining data/kdesu-5.74.0/src/suprocess.cpp
Examining data/kdesu-5.74.0/src/ssh.h
Examining data/kdesu-5.74.0/src/suprocess.h
Examining data/kdesu-5.74.0/src/ptyprocess.h
Examining data/kdesu-5.74.0/src/process.h
Examining data/kdesu-5.74.0/src/ptyprocess.cpp
Examining data/kdesu-5.74.0/src/su.h
Examining data/kdesu-5.74.0/src/stubprocess.cpp
Examining data/kdesu-5.74.0/src/sshprocess.h
Examining data/kdesu-5.74.0/src/kdesud/secure.h
Examining data/kdesu-5.74.0/src/kdesud/repo.cpp
Examining data/kdesu-5.74.0/src/kdesud/lexer.cpp
Examining data/kdesu-5.74.0/src/kdesud/handler.cpp
Examining data/kdesu-5.74.0/src/kdesud/secure.cpp
Examining data/kdesu-5.74.0/src/kdesud/kdesud.cpp
Examining data/kdesu-5.74.0/src/kdesud/lexer.h
Examining data/kdesu-5.74.0/src/kdesud/handler.h
Examining data/kdesu-5.74.0/src/kdesud/repo.h

FINAL RESULTS:

data/kdesu-5.74.0/src/kdesud/kdesud.cpp:256:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    chmod(sock.constData(), 0600);
data/kdesu-5.74.0/src/client.cpp:84: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(d->sock.constData(), R_OK | W_OK)) {
data/kdesu-5.74.0/src/client.cpp:96:5:  [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(addr.sun_path, d->sock.constData());
data/kdesu-5.74.0/src/kdesu_stub.c:121:5:  [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, name);
data/kdesu-5.74.0/src/kdesu_stub.c:123:5:  [4] (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).
    strcat(s, value);
data/kdesu-5.74.0/src/kdesu_stub.c:134:5:  [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(dst, src);
data/kdesu-5.74.0/src/kdesu_stub.c:332:20:  [4] (shell) popen:
  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.
            fout = popen("xauth >/dev/null 2>&1", "w");
data/kdesu-5.74.0/src/kdesu_stub.c:345:9:  [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("kdeinit5 --suicide");
data/kdesu-5.74.0/src/kdesu_stub.c:381:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(buf, "%s", params[P_COMMAND].value);
data/kdesu-5.74.0/src/kdesu_stub.c:383:9:  [4] (shell) execl:
  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.
        execl("/bin/sh", "sh", "-c", buf, (void *)0);
data/kdesu-5.74.0/src/kdesud/kdesud.cpp:186:10:  [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(sock.constData(), R_OK|W_OK))
data/kdesu-5.74.0/src/ptyprocess.cpp:340:5:  [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.
    execv(path.constData(), const_cast<char **>(argp));
data/kdesu-5.74.0/src/kdesu_stub.c:242:20:  [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.
    kdesu_lc_all = getenv("KDESU_LC_ALL");
data/kdesu-5.74.0/src/sshprocess.cpp:43:5:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srand(time(nullptr));
data/kdesu-5.74.0/src/client.cpp:187: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 buf[1024];
data/kdesu-5.74.0/src/kdesu_stub.c:192: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 buf[BUFSIZE + 1];
data/kdesu-5.74.0/src/kdesu_stub.c:193: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 xauthority[200];
data/kdesu-5.74.0/src/kdesu_stub.c:265: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).
    prio = atoi(params[P_PRIORITY].value);
data/kdesu-5.74.0/src/kdesu_stub.c:320:13:  [2] (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). Risk is low because the source is a constant string.
            strcpy(xauthority, "/tmp/xauth.XXXXXXXXXX");
data/kdesu-5.74.0/src/kdesu_stub.c:321:19:  [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).
            fd2 = mkstemp(xauthority);
data/kdesu-5.74.0/src/kdesud/kdesud.cpp:380:17:  [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 buf[101];
data/kdesu-5.74.0/src/ptyprocess.cpp:143:18:  [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 (!d->pty->open()) {
data/kdesu-5.74.0/src/client.cpp:42: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).
                      + strlen ((ptr)->sun_path))
data/kdesu-5.74.0/src/kdesu_stub.c:117:22:  [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 *s = malloc(strlen(name) + strlen(value) + 2);
data/kdesu-5.74.0/src/kdesu_stub.c:117:37:  [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 *s = malloc(strlen(name) + strlen(value) + 2);
data/kdesu-5.74.0/src/kdesu_stub.c:122: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(s, "=");
data/kdesu-5.74.0/src/kdesu_stub.c:132: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).
    int len = strlen(src);
data/kdesu-5.74.0/src/kdesu_stub.c:314:28:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
            int oldumask = umask(077);
data/kdesu-5.74.0/src/kdesu_stub.c:322:13:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
            umask(oldumask);
data/kdesu-5.74.0/src/kdesud/handler.cpp:246:72:  [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 (strncmp(env_str.constData(), "DESKTOP_STARTUP_ID=", strlen("DESKTOP_STARTUP_ID=")) != 0)
data/kdesu-5.74.0/src/kdesud/kdesud.cpp:82: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).
    (offsetof(struct sockaddr_un, sun_path) + strlen ((ptr)->sun_path)))
data/kdesu-5.74.0/src/kdesud/kdesud.cpp:224:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(addr.sun_path, sock.constData(), sizeof(addr.sun_path)-1);
data/kdesu-5.74.0/src/kdesud/kdesud.cpp:381:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                read(pipeOfDeath[0], buf, 100);
data/kdesu-5.74.0/src/ptyprocess.cpp:204:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        int nbytes = read(fd(), ret.data() + ret.size(), 0x8000);
data/kdesu-5.74.0/src/ptyprocess.cpp:369:13:  [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(10000);
data/kdesu-5.74.0/src/sshprocess.cpp:193:39:  [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(fd(), password, strlen(password));
data/kdesu-5.74.0/src/suprocess.cpp:248:39:  [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(fd(), password, strlen(password));

ANALYSIS SUMMARY:

Hits = 37
Lines analyzed = 4675 in approximately 0.17 seconds (27853 lines/second)
Physical Source Lines of Code (SLOC) = 3224
Hits@level = [0]  12 [1]  15 [2]   8 [3]   2 [4]  11 [5]   1
Hits@level+ = [0+]  49 [1+]  37 [2+]  22 [3+]  14 [4+]  12 [5+]   1
Hits/KSLOC@level+ = [0+] 15.1985 [1+] 11.4764 [2+] 6.82382 [3+] 4.34243 [4+] 3.72208 [5+] 0.310174
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.