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/kinit-5.74.0/src/klauncher_cmds.cpp
Examining data/kinit-5.74.0/src/kwrapper/kwrapper.cpp
Examining data/kinit-5.74.0/src/kwrapper/kwrapper_win.cpp
Examining data/kinit-5.74.0/src/kshell/shell.cpp
Examining data/kinit-5.74.0/src/kdeinit/proctitle.h
Examining data/kinit-5.74.0/src/kdeinit/kinit.h
Examining data/kinit-5.74.0/src/kdeinit/proctitle.cpp
Examining data/kinit-5.74.0/src/kdeinit/kinit_mac.h
Examining data/kinit-5.74.0/src/kdeinit/kinit.cpp
Examining data/kinit-5.74.0/src/kdeinit/kinit_win.cpp
Examining data/kinit-5.74.0/src/klauncher/klauncher.h
Examining data/kinit-5.74.0/src/klauncher/klauncher_adaptor.h
Examining data/kinit-5.74.0/src/klauncher/klauncher_main.cpp
Examining data/kinit-5.74.0/src/klauncher/klauncher_adaptor.cpp
Examining data/kinit-5.74.0/src/klauncher/klauncher.cpp
Examining data/kinit-5.74.0/src/klauncher_cmds.h
Examining data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c
Examining data/kinit-5.74.0/src/start_kdeinit/start_kdeinit_wrapper.c
Examining data/kinit-5.74.0/src/wrapper.cpp

FINAL RESULTS:

data/kinit-5.74.0/src/kdeinit/kinit.cpp:936:9:  [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(sock_file, 0600) != 0) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:660:17:  [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(executable.constData(), d.argv);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:852:13:  [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(path.data(), R_OK | W_OK)) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:867: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(sock_file, W_OK) == 0) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1379: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(sock_file, socketName.data());
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1563:24:  [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).
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/kinit_win.cpp:507:24:  [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).
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:159:17:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
            r = vsnprintf(ptitle + len, sizeof(ptitle) - len , fmt, ap);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:174:13:  [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(EXECUTE, (char **)new_argv);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:206: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(EXECUTE, argv);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit_wrapper.c:45:9:  [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(EXECUTE, argv);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit_wrapper.c:79: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(EXECUTE, argv);
data/kinit-5.74.0/src/wrapper.cpp:144: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(server.sun_path, sock_file);
data/kinit-5.74.0/src/wrapper.cpp:323:9:  [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[ 0 ], argv);
data/kinit-5.74.0/src/wrapper.cpp:378: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.
        startup_id = getenv("DESKTOP_STARTUP_ID");
data/kinit-5.74.0/src/kdeinit/kinit.cpp:115: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 sock_file[MAX_SOCK_FILE];
data/kinit-5.74.0/src/kdeinit/kinit.cpp:256:7:  [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).
    f.open(QFileDevice::WriteOnly);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:980: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 args[32];
data/kinit-5.74.0/src/kdeinit/kinit.cpp:981:5:  [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(args, "--fd=");
data/kinit-5.74.0/src/kdeinit/kinit.cpp:982:5:  [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(args + 5, "%d", d.launcher[1]);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1053:9:  [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(&l, request_data, sizeof(long));
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1081:13:  [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(&l, arg_n, sizeof(long));
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1096:13:  [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(&l, arg_n, sizeof(long));
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1436: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 errstr[256];
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1490:24:  [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 (!xauthfrom.open(QFile::ReadOnly) || !xauthfile.open(QFile::WriteOnly)
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1490:60:  [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 (!xauthfrom.open(QFile::ReadOnly) || !xauthfile.open(QFile::WriteOnly)
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1563:32:  [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.
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1591:24:  [2] (integer) atol:
  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).
            oom_pipe = atol(argv[i + 1]);
data/kinit-5.74.0/src/kdeinit/kinit_win.cpp:507:32:  [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.
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:139: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 ptitle[1024];
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:148: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(ptitle + len, ": ");
data/kinit-5.74.0/src/klauncher/klauncher.cpp:458: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(ba.data() + sz, &l, sizeof(long));
data/kinit-5.74.0/src/klauncher/klauncher_main.cpp:135:68:  [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).
    if (argc != 2 || memcmp(argv[1], "--fd=", 5) || !(launcherFd = atoi(argv[1] + 5))) {
data/kinit-5.74.0/src/kwrapper/kwrapper_win.cpp:138:19:  [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).
                f.open(QIODevice::ReadOnly);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:41: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/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:45:5:  [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(buf, "/proc/%d/oom_score_adj", pid);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:54: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).
        procfile = open(buf, O_WRONLY);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:64:5:  [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(buf, "/proc/%d/stat", pid);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:72:5:  [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(buf, "/proc/%d/oom_adj", pid);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:73:16:  [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).
    procfile = open(buf, O_WRONLY);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:90: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 helper_num[ 1024 ];
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:93: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 header[ 7 ];
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:164:9:  [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(helper_num, "%d", pipes[ 1 ]);
data/kinit-5.74.0/src/wrapper.cpp:263: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 cwd[8192];
data/kinit-5.74.0/src/wrapper.cpp:402: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(p, &arg_count, sizeof(arg_count));
data/kinit-5.74.0/src/wrapper.cpp:405: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(p, start, strlen(start) + 1);
data/kinit-5.74.0/src/wrapper.cpp:409:9:  [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(p, argv[i], strlen(argv[i]) + 1);
data/kinit-5.74.0/src/wrapper.cpp:415:9:  [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(p, &dummy, sizeof(dummy)); /* empty envc */
data/kinit-5.74.0/src/wrapper.cpp:419:9:  [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(p, cwd, strlen(cwd) + 1);
data/kinit-5.74.0/src/wrapper.cpp:422:9:  [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(p, &env_count, sizeof(env_count));
data/kinit-5.74.0/src/wrapper.cpp:427:13:  [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(p, environ[i], l);
data/kinit-5.74.0/src/wrapper.cpp:432:13:  [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(p, tty, strlen(tty) + 1);
data/kinit-5.74.0/src/wrapper.cpp:437: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(p, &avoid_loops, sizeof(avoid_loops));
data/kinit-5.74.0/src/wrapper.cpp:441:9:  [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(p, startup_id, strlen(startup_id) + 1);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:125:59:  [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).
    return QByteArray::fromRawData(displayEnvVarName_c(), strlen(displayEnvVarName_c()));
data/kinit-5.74.0/src/kdeinit/kinit.cpp:278: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).
        int ln = strlen(var);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:705:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            d.n = read(d.fd[0], &d.result, 1);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:716:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    d.n = read(d.fd[0], &l, sizeof(int));
data/kinit-5.74.0/src/kdeinit/kinit.cpp:720:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                        d.n = read(d.fd[0], tmp.data(), l);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:961:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        result = read(sock, buffer, bytes_left);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1056:35:  [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).
        const char *args = name + strlen(name) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1072: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).
            arg_n = arg_n + strlen(arg_n) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1077:35:  [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).
            cwd = arg_n; arg_n += strlen(cwd) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1086: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).
                arg_n = arg_n + strlen(arg_n) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1090:26:  [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).
                arg_n += strlen(tty) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1104: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).
            arg_n += strlen(startup_id_str) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1110:35:  [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).
            cwd = arg_n; arg_n += strlen(cwd) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1175: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).
        env_value = env_name + strlen(env_name) + 1;
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1182: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).
                (int)(strlen(env_name) + strlen(env_value) + 2)) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1182: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).
                (int)(strlen(env_name) + strlen(env_value) + 2)) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1255:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        while (read(d.deadpipe[0], &c, 1) == 1) {
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1489:26:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
        mode_t oldMask = umask(S_IRGRP | S_IROTH | S_IWGRP | S_IWOTH);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1496:9:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
        umask(oldMask);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1563: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).
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1630:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            while (read(d.initpipe[0], &c, 1) < 0)
data/kinit-5.74.0/src/kdeinit/kinit.cpp:1657:17:  [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).
    d.maxname = strlen(argv[0]);
data/kinit-5.74.0/src/kdeinit/kinit_win.cpp:507: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).
        safe_argv[i] = strcpy((char *)malloc(strlen(argv[i]) + 1), argv[i]);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:104:34:  [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).
            lastargv = argv[i] + strlen(argv[i]);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:108:34:  [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).
            lastargv = envp[i] + strlen(envp[i]);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:145:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(ptitle, __progname, sizeof(ptitle)-1);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:146: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(ptitle);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:169: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).
    pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0);
data/kinit-5.74.0/src/kdeinit/proctitle.cpp:171:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(argv_start, ptitle, argv_env_len);
data/kinit-5.74.0/src/klauncher/klauncher.cpp:223:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        const ssize_t result = read(sock, buffer, bytes_left);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:128:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (read(0, header, 7) == 7 && strncmp(header, "environ", 7) == 0) {
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:130:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (read(0, &count, sizeof(unsigned)) == sizeof(unsigned)
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:138:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    if (read(0, &len, sizeof(unsigned)) == sizeof(unsigned)
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:141:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                        if ((unsigned) read(0, env[ i ], len) == len) {
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit.c:182:23:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            int ret = read(pipes[ 0 ], &pid, sizeof(pid_t));
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit_wrapper.c:61: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).
            int len = strlen(environ[ i ]);
data/kinit-5.74.0/src/start_kdeinit/start_kdeinit_wrapper.c:63:45:  [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(pipes[ 1 ], environ[ i ], strlen(environ[ i ]));
data/kinit-5.74.0/src/wrapper.cpp:105:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        result = read(sock, buffer, bytes_left);
data/kinit-5.74.0/src/wrapper.cpp:129:9:  [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(sock_file) >= sizeof(server.sun_path)) {
data/kinit-5.74.0/src/wrapper.cpp:272:17:  [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).
    p = start + strlen(argv[0]);
data/kinit-5.74.0/src/wrapper.cpp:345: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).
    size += strlen(start) + 1; /* Size of first argument. */
data/kinit-5.74.0/src/wrapper.cpp:348:17:  [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 += strlen(argv[i]) + 1;
data/kinit-5.74.0/src/wrapper.cpp:357:17:  [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 += strlen(cwd) + 1;
data/kinit-5.74.0/src/wrapper.cpp:362:21:  [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 l = strlen(environ[env_count]) + 1;
data/kinit-5.74.0/src/wrapper.cpp:371:21:  [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 += strlen(tty) + 1;
data/kinit-5.74.0/src/wrapper.cpp:382:17:  [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 += strlen(startup_id) + 1;
data/kinit-5.74.0/src/wrapper.cpp:405: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).
    memcpy(p, start, strlen(start) + 1);
data/kinit-5.74.0/src/wrapper.cpp:406:10:  [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).
    p += strlen(start) + 1;
data/kinit-5.74.0/src/wrapper.cpp:409:28:  [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).
        memcpy(p, argv[i], strlen(argv[i]) + 1);
data/kinit-5.74.0/src/wrapper.cpp:410:14:  [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).
        p += strlen(argv[i]) + 1;
data/kinit-5.74.0/src/wrapper.cpp:419: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).
        memcpy(p, cwd, strlen(cwd) + 1);
data/kinit-5.74.0/src/wrapper.cpp:420:14:  [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).
        p += strlen(cwd) + 1;
data/kinit-5.74.0/src/wrapper.cpp:426:21:  [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 l = strlen(environ[i]) + 1;
data/kinit-5.74.0/src/wrapper.cpp:432:28:  [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).
            memcpy(p, tty, strlen(tty) + 1);
data/kinit-5.74.0/src/wrapper.cpp:433: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).
            p += strlen(tty) + 1;
data/kinit-5.74.0/src/wrapper.cpp:441: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).
        memcpy(p, startup_id, strlen(startup_id) + 1);
data/kinit-5.74.0/src/wrapper.cpp:442:14:  [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).
        p += strlen(startup_id) + 1;

ANALYSIS SUMMARY:

Hits = 111
Lines analyzed = 5842 in approximately 0.19 seconds (31322 lines/second)
Physical Source Lines of Code (SLOC) = 4429
Hits@level = [0]  92 [1]  57 [2]  39 [3]   1 [4]  13 [5]   1
Hits@level+ = [0+] 203 [1+] 111 [2+]  54 [3+]  15 [4+]  14 [5+]   1
Hits/KSLOC@level+ = [0+] 45.8343 [1+] 25.0621 [2+] 12.1924 [3+] 3.38677 [4+] 3.16098 [5+] 0.225785
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.