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/libblockdev-2.24/src/lib/blockdev.h
Examining data/libblockdev-2.24/src/lib/plugins.c
Examining data/libblockdev-2.24/src/lib/plugins.h
Examining data/libblockdev-2.24/src/plugins/btrfs.c
Examining data/libblockdev-2.24/src/plugins/btrfs.h
Examining data/libblockdev-2.24/src/plugins/check_deps.c
Examining data/libblockdev-2.24/src/plugins/check_deps.h
Examining data/libblockdev-2.24/src/plugins/crypto.c
Examining data/libblockdev-2.24/src/plugins/crypto.h
Examining data/libblockdev-2.24/src/plugins/dm.c
Examining data/libblockdev-2.24/src/plugins/dm.h
Examining data/libblockdev-2.24/src/plugins/fs.c
Examining data/libblockdev-2.24/src/plugins/fs.h
Examining data/libblockdev-2.24/src/plugins/fs/common.c
Examining data/libblockdev-2.24/src/plugins/fs/common.h
Examining data/libblockdev-2.24/src/plugins/fs/ext.c
Examining data/libblockdev-2.24/src/plugins/fs/ext.h
Examining data/libblockdev-2.24/src/plugins/fs/generic.c
Examining data/libblockdev-2.24/src/plugins/fs/generic.h
Examining data/libblockdev-2.24/src/plugins/fs/mount.c
Examining data/libblockdev-2.24/src/plugins/fs/mount.h
Examining data/libblockdev-2.24/src/plugins/fs/ntfs.c
Examining data/libblockdev-2.24/src/plugins/fs/ntfs.h
Examining data/libblockdev-2.24/src/plugins/fs/vfat.c
Examining data/libblockdev-2.24/src/plugins/fs/vfat.h
Examining data/libblockdev-2.24/src/plugins/fs/xfs.c
Examining data/libblockdev-2.24/src/plugins/fs/xfs.h
Examining data/libblockdev-2.24/src/plugins/kbd.c
Examining data/libblockdev-2.24/src/plugins/kbd.h
Examining data/libblockdev-2.24/src/plugins/loop.c
Examining data/libblockdev-2.24/src/plugins/loop.h
Examining data/libblockdev-2.24/src/plugins/lvm-dbus.c
Examining data/libblockdev-2.24/src/plugins/lvm.c
Examining data/libblockdev-2.24/src/plugins/lvm.h
Examining data/libblockdev-2.24/src/plugins/mdraid.c
Examining data/libblockdev-2.24/src/plugins/mdraid.h
Examining data/libblockdev-2.24/src/plugins/mpath.c
Examining data/libblockdev-2.24/src/plugins/mpath.h
Examining data/libblockdev-2.24/src/plugins/nvdimm.c
Examining data/libblockdev-2.24/src/plugins/nvdimm.h
Examining data/libblockdev-2.24/src/plugins/part.c
Examining data/libblockdev-2.24/src/plugins/part.h
Examining data/libblockdev-2.24/src/plugins/part_err.c
Examining data/libblockdev-2.24/src/plugins/part_err.h
Examining data/libblockdev-2.24/src/plugins/s390.c
Examining data/libblockdev-2.24/src/plugins/s390.h
Examining data/libblockdev-2.24/src/plugins/swap.c
Examining data/libblockdev-2.24/src/plugins/swap.h
Examining data/libblockdev-2.24/src/plugins/vdo.c
Examining data/libblockdev-2.24/src/plugins/vdo.h
Examining data/libblockdev-2.24/src/plugins/vdo_stats.c
Examining data/libblockdev-2.24/src/plugins/vdo_stats.h
Examining data/libblockdev-2.24/src/utils/dbus.c
Examining data/libblockdev-2.24/src/utils/dbus.h
Examining data/libblockdev-2.24/src/utils/dev_utils.c
Examining data/libblockdev-2.24/src/utils/dev_utils.h
Examining data/libblockdev-2.24/src/utils/exec.c
Examining data/libblockdev-2.24/src/utils/exec.h
Examining data/libblockdev-2.24/src/utils/extra_arg.c
Examining data/libblockdev-2.24/src/utils/extra_arg.h
Examining data/libblockdev-2.24/src/utils/module.c
Examining data/libblockdev-2.24/src/utils/module.h
Examining data/libblockdev-2.24/src/utils/sizes.h
Examining data/libblockdev-2.24/src/utils/utils.h
Examining data/libblockdev-2.24/tools/lvm-cache-stats.c

FINAL RESULTS:

data/libblockdev-2.24/src/plugins/btrfs.c:332: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 (*device_p, F_OK) != 0) {
data/libblockdev-2.24/src/plugins/crypto.c:2130:165:  [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.
gboolean bd_crypto_tc_open_full (const gchar *device, const gchar *name, const guint8* pass_data, gsize data_len, const gchar **keyfiles, gboolean hidden, gboolean system, gboolean veracrypt, guint32 veracrypt_pim, gboolean read_only, GError **error) {
data/libblockdev-2.24/src/plugins/crypto.c:2172: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.
    if (system)
data/libblockdev-2.24/src/plugins/crypto.h:214:165:  [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.
gboolean bd_crypto_tc_open_full (const gchar *device, const gchar *name, const guint8* pass_data, gsize data_len, const gchar **keyfiles, gboolean hidden, gboolean system, gboolean veracrypt, guint32 veracrypt_pim, gboolean read_only, GError **error);
data/libblockdev-2.24/src/plugins/dm.c:237: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 (sys_path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:388: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 ("/sys/class/zram-control/hot_add", R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:645: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 (path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:930: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 (path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:1334: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 (path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:1501: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 (path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/kbd.c:1555: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 (path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/loop.c:117: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 (sys_path, R_OK) != 0) {
data/libblockdev-2.24/src/plugins/lvm-dbus.c:1476: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 (device, F_OK) != 0) {
data/libblockdev-2.24/src/plugins/mdraid.c:480:7:  [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, F_OK) == 0)
data/libblockdev-2.24/src/plugins/mdraid.c:506:11:  [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 (input, F_OK) == 0)
data/libblockdev-2.24/src/plugins/mdraid.c:516:11:  [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 (name_path_str, F_OK) == 0)
data/libblockdev-2.24/src/plugins/mdraid.c:518:16:  [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.
      else if (access (md_path_str, F_OK) == 0)
data/libblockdev-2.24/tools/lvm-cache-stats.c:41:5:  [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.
    printf ("  read hits:    %10"G_GUINT64_FORMAT, stats->read_hits); print_ratio (stats->read_hits, stats->read_hits + stats->read_misses, TRUE, TRUE);
data/libblockdev-2.24/tools/lvm-cache-stats.c:43:5:  [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.
    printf ("  write hits:   %10"G_GUINT64_FORMAT, stats->write_hits); print_ratio (stats->write_hits, stats->write_hits + stats->write_misses, TRUE, TRUE);
data/libblockdev-2.24/src/plugins/crypto.c:409:61:  [3] (random) g_random_int_range:
  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.
        ret[i+offset] = BD_CRYPTO_BACKUP_PASSPHRASE_CHARSET[g_random_int_range(0, charset_length)];
data/libblockdev-2.24/src/plugins/fs/generic.c:404:59:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
            mountpoint = g_build_path (G_DIR_SEPARATOR_S, g_get_tmp_dir (), "blockdev.XXXXXX", NULL);
data/libblockdev-2.24/src/plugins/vdo.c:275:23:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
        ret->device = realpath (ret->device, NULL);
data/libblockdev-2.24/src/plugins/crypto.c:440:10:  [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 (device, O_RDONLY|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/crypto.c:782:25:  [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).
        dev_random_fd = open ("/dev/random", O_RDONLY);
data/libblockdev-2.24/src/plugins/crypto.c:2067:10:  [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 (device, O_RDONLY);
data/libblockdev-2.24/src/plugins/dm.c:491:24:  [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 (major >= 0 && (atoi (major_str) != major))
data/libblockdev-2.24/src/plugins/dm.c:494:24:  [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 (minor >= 0 && (atoi (minor_str) != minor))
data/libblockdev-2.24/src/plugins/fs/common.c:97:10:  [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 (device, O_RDWR|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/fs/common.c:246:10:  [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 (device, O_RDONLY|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/fs/generic.c:113:10:  [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 (device, mode);
data/libblockdev-2.24/src/plugins/fs/generic.c:296:10:  [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 (device, O_RDONLY|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/fs/generic.c:751:10:  [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 (mountpoint, O_RDONLY);
data/libblockdev-2.24/src/plugins/fs/mount.c:107: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[MOUNT_ERR_BUF_SIZE] = {0};
data/libblockdev-2.24/src/plugins/fs/mount.c:331: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[MOUNT_ERR_BUF_SIZE] = {0};
data/libblockdev-2.24/src/plugins/loop.c:202:10:  [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 (file, O_RDWR);
data/libblockdev-2.24/src/plugins/loop.c:238:23:  [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).
    loop_control_fd = open ("/dev/loop-control", O_RDWR);
data/libblockdev-2.24/src/plugins/loop.c:262:15:  [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).
    loop_fd = open (loop_device, read_only ? O_RDONLY : O_RDWR);
data/libblockdev-2.24/src/plugins/loop.c:328:15:  [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).
    loop_fd = open (dev_loop ? dev_loop : loop, O_RDONLY);
data/libblockdev-2.24/src/plugins/loop.c:390:10:  [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 (dev_loop ? dev_loop : loop, O_RDONLY);
data/libblockdev-2.24/src/plugins/loop.c:435:10:  [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 (dev_loop ? dev_loop : loop, O_RDWR);
data/libblockdev-2.24/src/plugins/mdraid.c:285: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 time_str[20];
data/libblockdev-2.24/src/plugins/mdraid.c:1165: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 (dest, next_set, 8);
data/libblockdev-2.24/src/plugins/mdraid.c:1172: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1179: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1186: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1193: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1198: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 (dest, next_set, 9);
data/libblockdev-2.24/src/plugins/mdraid.c:1240: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 (dest, next_set, 8);
data/libblockdev-2.24/src/plugins/mdraid.c:1247: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1252: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1259: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1264: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 (dest, next_set, 4);
data/libblockdev-2.24/src/plugins/mdraid.c:1271: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 (dest, next_set, 9);
data/libblockdev-2.24/src/plugins/part.c:245: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).
    dev_fd = open (disk->dev->path, O_RDONLY|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/part.c:504:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1165:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1265:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1303: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).
            fd = open (part, O_RDONLY);
data/libblockdev-2.24/src/plugins/part.c:1443:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1624:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1743:16:  [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).
    part_num = atoi (part_num_str);
data/libblockdev-2.24/src/plugins/part.c:1821:50:  [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 ((g_strcmp0 (part_num_str, "0") != 0) && (atoi (part_num_str) == 0)) {
data/libblockdev-2.24/src/plugins/part.c:1893:50:  [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 ((g_strcmp0 (part_num_str, "0") != 0) && (atoi (part_num_str) == 0)) {
data/libblockdev-2.24/src/plugins/part.c:1942:50:  [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 ((g_strcmp0 (part_num_str, "0") != 0) && (atoi (part_num_str) == 0)) {
data/libblockdev-2.24/src/plugins/s390.c:185:10:  [2] (misc) fopen:
  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 = fopen(path, "r");
data/libblockdev-2.24/src/plugins/s390.c:238:10:  [2] (misc) fopen:
  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 = fopen(path, "r+");
data/libblockdev-2.24/src/plugins/s390.c:249:14:  [2] (misc) fopen:
  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 = fopen(path, "r+");
data/libblockdev-2.24/src/plugins/s390.c:328: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).
    if ((f = open(devname, O_RDONLY)) == -1) {
data/libblockdev-2.24/src/plugins/s390.c:386: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).
    if ((f = open(devname, O_RDONLY)) == -1) {
data/libblockdev-2.24/src/plugins/s390.c:600:10:  [2] (misc) fopen:
  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 = fopen (online, "r");
data/libblockdev-2.24/src/plugins/s390.c:613:14:  [2] (misc) fopen:
  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 = fopen (online, "r");
data/libblockdev-2.24/src/plugins/s390.c:672:10:  [2] (misc) fopen:
  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 = fopen (unitadd, "w");
data/libblockdev-2.24/src/plugins/s390.c:696:10:  [2] (misc) fopen:
  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 = fopen (failed, "r");
data/libblockdev-2.24/src/plugins/s390.c:789:14:  [2] (misc) fopen:
  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).
    scsifd = fopen (path, "r");
data/libblockdev-2.24/src/plugins/s390.c:814:14:  [2] (misc) fopen:
  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 = fopen (hba_path, "r");
data/libblockdev-2.24/src/plugins/s390.c:832:14:  [2] (misc) fopen:
  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 = fopen (wwpn_path, "r");
data/libblockdev-2.24/src/plugins/s390.c:851:14:  [2] (misc) fopen:
  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 = fopen (lun_path, "r");
data/libblockdev-2.24/src/plugins/s390.c:873:18:  [2] (misc) fopen:
  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 = fopen (scsidel, "w");
data/libblockdev-2.24/src/plugins/s390.c:950:10:  [2] (misc) fopen:
  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 = fopen (unitrm, "w");
data/libblockdev-2.24/src/plugins/swap.c:212:10:  [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 (device, O_RDONLY|O_CLOEXEC);
data/libblockdev-2.24/src/plugins/crypto.c:398: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).
    guint8 charset_length = strlen (BD_CRYPTO_BACKUP_PASSPHRASE_CHARSET);
data/libblockdev-2.24/src/plugins/crypto.c:925:92:  [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 luks_format (device, cipher, key_size, (const guint8*) passphrase, passphrase ? strlen(passphrase) : 0, key_file, min_entropy, BD_CRYPTO_LUKS_VERSION_LUKS1, NULL, error);
data/libblockdev-2.24/src/plugins/crypto.c:980:92:  [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 luks_format (device, cipher, key_size, (const guint8*) passphrase, passphrase ? strlen(passphrase) : 0, key_file, min_entropy, luks_version, extra, error);
data/libblockdev-2.24/src/plugins/crypto.c:1102:78:  [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 luks_open (device, name, (const guint8*) passphrase, passphrase ? strlen (passphrase) : 0, key_file, read_only, error);
data/libblockdev-2.24/src/plugins/crypto.c:1265:19:  [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).
        buf_len = strlen (pass);
data/libblockdev-2.24/src/plugins/crypto.c:1274:20:  [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).
        nbuf_len = strlen (npass);
data/libblockdev-2.24/src/plugins/crypto.c:1387:19:  [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).
        buf_len = strlen (pass);
data/libblockdev-2.24/src/plugins/crypto.c:1473:68:  [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 bd_crypto_luks_change_key_blob (device, (guint8*) pass, strlen (pass), (guint8*) npass, strlen (npass), error);
data/libblockdev-2.24/src/plugins/crypto.c:1473:100:  [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 bd_crypto_luks_change_key_blob (device, (guint8*) pass, strlen (pass), (guint8*) npass, strlen (npass), error);
data/libblockdev-2.24/src/plugins/crypto.c:1611:85:  [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 luks_resize (luks_device, size, (const guint8*) passphrase, passphrase ? strlen (passphrase) : 0, key_file, error);
data/libblockdev-2.24/src/plugins/crypto.c:1771:73:  [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 luks_resume (luks_device, (guint8*) passphrase, passphrase ? strlen (passphrase) : 0, key_file, error);
data/libblockdev-2.24/src/plugins/crypto.c:2074:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (read (fd, buf, sizeof(buf)) != sizeof(buf)) {
data/libblockdev-2.24/src/plugins/crypto.c:2388:56:  [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).
    cert = CERT_DecodeCertFromPackage (cert_data_copy, strlen(cert_data_copy));
data/libblockdev-2.24/src/plugins/crypto.c:2428:90:  [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 (libvk_volume_add_secret (volume, LIBVK_SECRET_PASSPHRASE, backup_passphrase, strlen (backup_passphrase), error) != 0) {
data/libblockdev-2.24/src/plugins/dm.c:462: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).
    if (dev_name && strlen (dev_name) > 1) {
data/libblockdev-2.24/src/plugins/dm.c:466: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).
    if (dev_name && strlen (dev_name) > 1) {
data/libblockdev-2.24/src/plugins/fs/generic.c:650: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(exec_util) == 0) { /* empty string if no util needed */
data/libblockdev-2.24/src/plugins/fs/mount.c:226: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).
                if (args->fstype == NULL || strlen (args->fstype) == 0)
data/libblockdev-2.24/src/plugins/fs/mount.c:486:57:  [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 (write(pipefd[1], (*error)->message, strlen((*error)->message)) < 0)
data/libblockdev-2.24/src/plugins/fs/mount.c:495:57:  [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 (write(pipefd[1], (*error)->message, strlen((*error)->message)) < 0)
data/libblockdev-2.24/src/plugins/fs/mount.c:503:53:  [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 (write(pipefd[1], (*error)->message, strlen((*error)->message)) < 0)
data/libblockdev-2.24/src/plugins/kbd.c:788:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy (device_uuid[n], s, 63);
data/libblockdev-2.24/src/plugins/part.c:430: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).
        if (isdigit (dev->path[strlen(dev->path) - 1]))
data/libblockdev-2.24/src/plugins/part.c:498: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1159: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1259: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1437: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1618: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1737: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1815: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1871: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/part.c:1936: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).
    part_num_str = part + (strlen (part) - 1);
data/libblockdev-2.24/src/plugins/s390.c:205:53:  [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 (g_ascii_strncasecmp (status, "unformatted", strlen(status)) == 0) {
data/libblockdev-2.24/src/plugins/s390.c:265:14:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    online = fgetc(fd);
data/libblockdev-2.24/src/plugins/s390.c:451: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(tmptok) < 4)
data/libblockdev-2.24/src/plugins/s390.c:452: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).
        prepend = g_strnfill((4 - strlen(tmptok)), '0');
data/libblockdev-2.24/src/plugins/s390.c:481:40:  [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 ((wwpn == NULL) || (!*wwpn) || (strlen(wwpn) < 2)) {
data/libblockdev-2.24/src/plugins/s390.c:518:38:  [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 ((lun == NULL) || (!*lun) || (strlen(lun) > 18)) {
data/libblockdev-2.24/src/plugins/s390.c:527: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).
    if ((g_str_has_prefix(lclun, "0x")) && (strlen(lclun) == 18)) {
data/libblockdev-2.24/src/plugins/s390.c:541: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).
        if (strlen(tmplun) < 4) {
data/libblockdev-2.24/src/plugins/s390.c:543: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).
            prepend = g_strnfill((4 - strlen(tmplun)), '0');
data/libblockdev-2.24/src/plugins/s390.c:545:40:  [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).
            append = g_strnfill((16 - (strlen(tmplun) + strlen(prepend))), '0');
data/libblockdev-2.24/src/plugins/s390.c:545:57:  [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).
            append = g_strnfill((16 - (strlen(tmplun) + strlen(prepend))), '0');
data/libblockdev-2.24/src/plugins/s390.c:550:40:  [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).
            append = g_strnfill((16 - (strlen(tmplun))), '0');
data/libblockdev-2.24/src/plugins/s390.c:627:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rc = fgetc (fd);
data/libblockdev-2.24/src/plugins/s390.c:706:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rc = fgetc (fd);
data/libblockdev-2.24/src/plugins/s390.c:763:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ssize_t read, rc;
data/libblockdev-2.24/src/plugins/swap.c:317:27:  [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).
    status_len = (gint64) strlen (value);
data/libblockdev-2.24/src/plugins/vdo.c:218:63:  [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).
    yaml_parser_set_input_string (&parser, (guchar *) output, strlen (output));

ANALYSIS SUMMARY:

Hits = 129
Lines analyzed = 28866 in approximately 0.80 seconds (36267 lines/second)
Physical Source Lines of Code (SLOC) = 17851
Hits@level = [0]  21 [1]  49 [2]  58 [3]   3 [4]  19 [5]   0
Hits@level+ = [0+] 150 [1+] 129 [2+]  80 [3+]  22 [4+]  19 [5+]   0
Hits/KSLOC@level+ = [0+] 8.40289 [1+] 7.22649 [2+] 4.48154 [3+] 1.23242 [4+] 1.06437 [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.