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/k4dirstat-3.2.1/src/k4dirstat.cpp
Examining data/k4dirstat-3.2.1/src/k4dirstat.h
Examining data/k4dirstat-3.2.1/src/kactivitytracker.h
Examining data/k4dirstat-3.2.1/src/kcleanup.cpp
Examining data/k4dirstat-3.2.1/src/kcleanup.h
Examining data/k4dirstat-3.2.1/src/kcleanup_dummy.cpp
Examining data/k4dirstat-3.2.1/src/kcleanupcollection.cpp
Examining data/k4dirstat-3.2.1/src/kcleanupcollection.h
Examining data/k4dirstat-3.2.1/src/kcleanupcollection_p.h
Examining data/k4dirstat-3.2.1/src/kdirinfo.cpp
Examining data/k4dirstat-3.2.1/src/kdirinfo.h
Examining data/k4dirstat-3.2.1/src/kdirreadjob.cpp
Examining data/k4dirstat-3.2.1/src/kdirreadjob.h
Examining data/k4dirstat-3.2.1/src/kdirstatsettings.cpp
Examining data/k4dirstat-3.2.1/src/kdirstatsettings.h
Examining data/k4dirstat-3.2.1/src/kdirtree.cpp
Examining data/k4dirstat-3.2.1/src/kdirtree.h
Examining data/k4dirstat-3.2.1/src/kdirtreecache.cpp
Examining data/k4dirstat-3.2.1/src/kdirtreecache.h
Examining data/k4dirstat-3.2.1/src/kdirtreeview.cpp
Examining data/k4dirstat-3.2.1/src/kdirtreeview.h
Examining data/k4dirstat-3.2.1/src/kexcluderules.cpp
Examining data/k4dirstat-3.2.1/src/kexcluderules.h
Examining data/k4dirstat-3.2.1/src/kfileinfo.cpp
Examining data/k4dirstat-3.2.1/src/kfileinfo.h
Examining data/k4dirstat-3.2.1/src/kstdcleanup.cpp
Examining data/k4dirstat-3.2.1/src/kstdcleanup.h
Examining data/k4dirstat-3.2.1/src/ktreemaptile.cpp
Examining data/k4dirstat-3.2.1/src/ktreemaptile.h
Examining data/k4dirstat-3.2.1/src/ktreemapview.cpp
Examining data/k4dirstat-3.2.1/src/ktreemapview.h
Examining data/k4dirstat-3.2.1/src/main.cpp

FINAL RESULTS:

data/k4dirstat-3.2.1/src/k4dirstat.cpp:480: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(file_name.toLatin1(), F_OK) == 0) // file exists
data/k4dirstat-3.2.1/src/kcleanupcollection.cpp:91:8:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    id.sprintf("cleanup_user_defined_%d", _nextUserCleanupNo);
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:134:9:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    str.sprintf("%lldG", size / GB);
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:139:9:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    str.sprintf("%lldM", size / MB);
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:144:9:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    str.sprintf("%lldK", size / KB);
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:148:7:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  str.sprintf("%lld", size);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:993:12:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
      name.sprintf("fillColor_%02d", i);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1009:10:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    name.sprintf("fillColor_%02d", i);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1115:19:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    formattedTime.sprintf("%02d:%02d:%02d.%03ld", hours, min, sec, millisec);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1117:19:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    formattedTime.sprintf("%02d:%02d:%02d", hours, min, sec);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1136:17:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  percentString.sprintf("%.1f%%", percent);
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1181:18:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  timeDateString.sprintf("%4d-%02d-%02d  %02d:%02d:%02d", t->tm_year + 1900,
data/k4dirstat-3.2.1/src/kfileinfo.cpp:286:18:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
      sizeString.sprintf("%.1f", size);
data/k4dirstat-3.2.1/src/kfileinfo.cpp:292:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        sizeString.sprintf("%.1f", size);
data/k4dirstat-3.2.1/src/kfileinfo.cpp:297:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        sizeString.sprintf("%.2f", size);
data/k4dirstat-3.2.1/src/k4dirstat.cpp:175: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).
      KStandardAction::open(this, SLOT(fileAskOpenDir()), actionCollection());
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:288:27:  [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 links = links_str ? atoi(links_str) : 1;
data/k4dirstat-3.2.1/src/kdirtreecache.h:211: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 _buffer[MAX_CACHE_LINE_LEN];
data/k4dirstat-3.2.1/src/kdirtreecache.h:215: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 *_fields[MAX_FIELDS_PER_LINE];
data/k4dirstat-3.2.1/src/kdirtreeview.cpp:1085: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 key[sizeof(KFileSize) * 2 + 1]; // 2 hex digits per byte required
data/k4dirstat-3.2.1/src/kdirreadjob.cpp:43:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
void KDirReadJob::read() {
data/k4dirstat-3.2.1/src/kdirreadjob.cpp:379:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
void KCacheReadJob::read() {
data/k4dirstat-3.2.1/src/kdirreadjob.cpp:391:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  _reader->read(1000);
data/k4dirstat-3.2.1/src/kdirreadjob.cpp:468:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    _queue.first()->read();
data/k4dirstat-3.2.1/src/kdirreadjob.h:74:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  virtual void read();
data/k4dirstat-3.2.1/src/kdirreadjob.h:304:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  void read() override;
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:197:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
bool KCacheReader::read(int maxLines) {
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:495: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).
  char *end = _line + strlen(_line);
data/k4dirstat-3.2.1/src/kdirtreecache.cpp:542: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).
  cptr = start + strlen(start) - 1;
data/k4dirstat-3.2.1/src/kdirtreecache.h:95:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  bool read(int maxLines = 0);

ANALYSIS SUMMARY:

Hits = 30
Lines analyzed = 11655 in approximately 0.29 seconds (39551 lines/second)
Physical Source Lines of Code (SLOC) = 6147
Hits@level = [0]   0 [1]  10 [2]   5 [3]   0 [4]  15 [5]   0
Hits@level+ = [0+]  30 [1+]  30 [2+]  20 [3+]  15 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 4.88043 [1+] 4.88043 [2+] 3.25362 [3+] 2.44021 [4+] 2.44021 [5+]   0
Dot directories skipped = 2 (--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.