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/btrfs-compsize-1.3/compsize.c
Examining data/btrfs-compsize-1.3/endianness.h
Examining data/btrfs-compsize-1.3/kerncompat.h
Examining data/btrfs-compsize-1.3/radix-tree.c
Examining data/btrfs-compsize-1.3/radix-tree.h

FINAL RESULTS:

data/btrfs-compsize-1.3/compsize.c:21:35:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    #define DPRINTF(fmt, args...) fprintf(stderr, fmt, ##args)
data/btrfs-compsize-1.3/compsize.c:62:62:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
static void die(const char *txt, ...) __attribute__((format (printf, 1, 2)));
data/btrfs-compsize-1.3/compsize.c:67: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, txt, ap);
data/btrfs-compsize-1.3/compsize.c:296:21:  [4] (format) snprintf:
  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.
                    snprintf(fn, path_size, (slash && !slash[1]) ? "%s%s"
data/btrfs-compsize-1.3/compsize.c:317:22:  [4] (format) snprintf:
  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.
        return (void)snprintf(output, HB, "%"PRIu64, x);
data/btrfs-compsize-1.3/kerncompat.h:279:30:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define printk(fmt, args...) fprintf(stderr, fmt, ##args)
data/btrfs-compsize-1.3/compsize.c:349:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
        switch (getopt_long(argc, argv, short_options, long_options, 0))
data/btrfs-compsize-1.3/compsize.c:54:14:  [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 const char *comp_types[MAX_ENTRIES] = { "none", "zlib", "lzo", "zstd" };
data/btrfs-compsize-1.3/compsize.c:244:14:  [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).
        fd = open(path, O_RDONLY|O_NOFOLLOW|O_NOCTTY|O_NONBLOCK);
data/btrfs-compsize-1.3/compsize.c:367: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 perc[8], disk_usage[HB], uncomp_usage[HB], refd_usage[HB];
data/btrfs-compsize-1.3/compsize.c:408: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 unkn_comp[12];
data/btrfs-compsize-1.3/compsize.c:276: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).
            path_size += strlen(path) + NAME_MAX;

ANALYSIS SUMMARY:

Hits = 12
Lines analyzed = 1845 in approximately 0.06 seconds (31223 lines/second)
Physical Source Lines of Code (SLOC) = 1299
Hits@level = [0]  14 [1]   1 [2]   4 [3]   1 [4]   6 [5]   0
Hits@level+ = [0+]  26 [1+]  12 [2+]  11 [3+]   7 [4+]   6 [5+]   0
Hits/KSLOC@level+ = [0+] 20.0154 [1+] 9.23788 [2+] 8.46805 [3+] 5.38876 [4+] 4.61894 [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.