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/kcrash-5.74.0/autotests/kcrashtest.cpp Examining data/kcrash-5.74.0/autotests/coreconfigtest.cpp Examining data/kcrash-5.74.0/autotests/test_crasher.cpp Examining data/kcrash-5.74.0/src/kcrash.h Examining data/kcrash-5.74.0/src/coreconfig.cpp Examining data/kcrash-5.74.0/src/coreconfig_p.h Examining data/kcrash-5.74.0/src/kcrash.cpp FINAL RESULTS: data/kcrash-5.74.0/src/kcrash.cpp:780: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(drkonqi_server.sun_path, socketpath.constData()); data/kcrash-5.74.0/src/kcrash.cpp:473:29: [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. argv[i++] = getenv("DISPLAY"); data/kcrash-5.74.0/src/kcrash.cpp:580:20: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. bool success = CreateProcess(0, (wchar_t *) cmdLine.utf16(), NULL, NULL, data/kcrash-5.74.0/src/kcrash.cpp:580:20: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. bool success = CreateProcess(0, (wchar_t *) cmdLine.utf16(), NULL, NULL, data/kcrash-5.74.0/autotests/kcrashtest.cpp:34: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 (!logFile.open(QIODevice::ReadOnly)) { data/kcrash-5.74.0/autotests/test_crasher.cpp:51:17: [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 (!output.open(QIODevice::WriteOnly | QIODevice::Append)) data/kcrash-5.74.0/src/coreconfig.cpp:23: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). if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { data/kcrash-5.74.0/src/kcrash.cpp:269:36: [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. s_autoRestartCommandLine = new char *[args.count() + 1]; data/kcrash-5.74.0/src/kcrash.cpp:454:15: [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 *argv[29]; // don't forget to update this data/kcrash-5.74.0/src/kcrash.cpp:492:9: [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 sigtxt[ 10 ]; data/kcrash-5.74.0/src/kcrash.cpp:493: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(sigtxt, "%d", sig); data/kcrash-5.74.0/src/kcrash.cpp:497:9: [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 pidtxt[ 20 ]; data/kcrash-5.74.0/src/kcrash.cpp:498: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(pidtxt, "%lld", QCoreApplication::applicationPid()); data/kcrash-5.74.0/src/kcrash.cpp:536:9: [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 threadId[8] = { 0 }; data/kcrash-5.74.0/src/kcrash.cpp:537: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(threadId, "%d", GetCurrentThreadId()); data/kcrash-5.74.0/src/kcrash.cpp:614:5: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. CopyMemory((PVOID) pBuf, exceptionInfo->ContextRecord, sizeof(CONTEXT)); data/kcrash-5.74.0/src/kcrash.cpp:832: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 msg[msize]; data/kcrash-5.74.0/src/kcrash.cpp:834:20: [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). int dpid = atoi(msg); data/kcrash-5.74.0/src/kcrash.cpp:749: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); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1283 in approximately 0.51 seconds (2514 lines/second) Physical Source Lines of Code (SLOC) = 866 Hits@level = [0] 15 [1] 1 [2] 14 [3] 3 [4] 1 [5] 0 Hits@level+ = [0+] 34 [1+] 19 [2+] 18 [3+] 4 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 39.261 [1+] 21.94 [2+] 20.7852 [3+] 4.61894 [4+] 1.15473 [5+] 0 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.