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/libvirt-sandbox-0.5.1+git20160404/bin/virt-sandbox-service-util.c
Examining data/libvirt-sandbox-0.5.1+git20160404/bin/virt-sandbox.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-container.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-container.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-private.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-all.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-disk.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-disk.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-initrd.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-initrd.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-interactive.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-interactive.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-file.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-file.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-ram.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount-ram.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-mount.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-address.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-address.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-filterref.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-filterref.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-route.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network-route.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-network.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service-generic.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service-generic.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service-systemd.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service-systemd.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config-service.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-raw.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-raw.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-rpc.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-rpc.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context-interactive.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context-interactive.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context-service.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context-service.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-context.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-main.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-main.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-rpcpacket.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-rpcpacket.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-util.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-util.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox.h
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/tests/test-config.c
Examining data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.c

FINAL RESULTS:

data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:152: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(dst, mode) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.c:400: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("/dev/kvm", W_OK) == 0)
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:123: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(devname, R_OK|W_OK) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:155:9:  [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(shellargv[0], (char**)shellargv);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:519: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(appargv[0], appargv);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:1371: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(command[0], (char**)command);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:93: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(args[0], (char**)args);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:455: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(args[0], (char**)args);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-container.c:128:9:  [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.
    if (getenv("LIBVIRT_SANDBOX_INIT_DEBUG"))
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-container.c:131:16:  [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.
    if ((tmp = getenv("LIBVIRT_SANDBOX_STRACE"))) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.c:159:27:  [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.
    const gchar *tmpdir = getenv("TEMPDIR");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.c:246:9:  [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.
    if (getenv("LIBVIRT_SANDBOX_INIT_DEBUG"))
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.c:251:16:  [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.
    if ((tmp = getenv("LIBVIRT_SANDBOX_STRACE"))) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:442:57:  [3] (buffer) g_get_home_dir:
  This function is synonymous with 'getenv("HOME")';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.
                                                        g_get_home_dir(),
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:493:30:  [3] (buffer) g_get_home_dir:
  This function is synonymous with 'getenv("HOME")';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.
    priv->homedir = g_strdup(g_get_home_dir());
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:1316:9:  [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.
    if (getenv("LIBVIRT_LXC_NAME")) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:54:9:  [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.
    if (getenv("LIBVIRT_LXC_UUID") == NULL) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:102:23:  [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.
    const char *env = getenv("LIBVIRT_LXC_CMDLINE");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:113:21:  [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.
    char *cmdline = getenv("LIBVIRT_LXC_CMDLINE");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:354:9:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
    if (chroot("/tmproot") < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-main.c:80:9:  [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.
    if (getenv("LIBVIRT_SANDBOX_DEBUG"))
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-main.c:84:10:  [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.
    if (!getenv("LIBVIRT_SANDBOX_DEBUG"))
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-raw.c:664:33:  [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 ((priv->consolePty = open(pty, O_NOCTTY|O_RDWR)) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-rpc.c:645: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(priv->localToStdout + priv->localToStdoutLength,
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-rpc.c:663: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(priv->localToStderr + priv->localToStderrLength,
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-console-rpc.c:735: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(priv->rx, pkt, sizeof(*pkt));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:70:12:  [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 line[1024];
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:74: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).
    fp = fopen(SANDBOXCONFIGDIR "/disks.cfg", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:141: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).
        int tty = open(devname, O_RDWR);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:695: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 ((fd = open(dev_path, O_RDONLY)) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:1074:49:  [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(hostToStdin,
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:1325: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 ((host = open(devname, O_RDWR)) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:50:11:  [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 *args[50];
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:64: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 line[1024];
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:128: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).
    if ((fd = open(file, O_CREAT|O_WRONLY, mode)) < 0 &&
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:231:16:  [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).
    FILE *fp = fopen(MOUNTS_CONFIG_FILE, "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:305:11:  [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 *args[50];
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:321:16:  [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).
    FILE *fp = fopen("/modules", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:386: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).
    fp = fopen(SANDBOXCONFIGDIR "/mounts.cfg", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:476: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).
    if ((fd = open(filename, O_RDONLY)) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:703:16:  [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).
    FILE *fp = fopen("/proc/uptime", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:733:16:  [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).
    FILE *fp = fopen("/proc/cmdline", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:752:16:  [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).
    FILE *fp = fopen("/proc/cmdline", "r");
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-rpcpacket.c:295: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(msg->buffer + msg->bufferOffset, data, len);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-rpcpacket.h:34: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 buffer[GVIR_SANDBOX_PROTOCOL_PACKET_MAX + GVIR_SANDBOX_PROTOCOL_LEN_MAX];
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.c:409:58:  [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).
                                               basename, strlen(basename),
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.c:506:12:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    mask = umask(0077);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-initrd.c:526:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(mask);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder-machine.c:339: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).
                                       line, strlen(line),
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-builder.c:480: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).
                                       line, strlen(line),
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:959:60:  [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).
                                                   param + strlen("source="));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:962: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).
                                                param + strlen("mac="));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:965:44:  [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).
            gchar *tail = g_strdup(param + strlen("filter."));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:992:44:  [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).
            gchar *name = g_strdup(param + strlen("filter="));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:1001:47:  [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).
            gchar *primary = g_strdup(param + strlen("address="));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:1060: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).
            gchar *target = g_strdup(param + strlen("route="));
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:1724:36:  [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).
                relguest = guest + strlen(target);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:1787:36:  [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).
                relguest = guest + strlen(target);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-config.c:2768:48:  [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_key_file_load_from_data(file, data, strlen(data), G_KEY_FILE_NONE, error))
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:738: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).
    int n1 = strlen(vp1);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:739: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).
    int n2 = strlen(vp2);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:805:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    got = read(fd, buf, len);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-common.c:953:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    if (read(sigread, &ignore, 1) != 1)
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-lxc.c:123: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).
    start += strlen(name);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:328: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).
        size_t n = strlen(line);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:380:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0022);
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:493:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if ((got = read(fd, data + offset, capacity - offset)) < 0) {
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:514: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).
             offset[strlen(ext)] == '\0');
data/libvirt-sandbox-0.5.1+git20160404/libvirt-sandbox/libvirt-sandbox-init-qemu.c:772: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).
    start += strlen(name);

ANALYSIS SUMMARY:

Hits = 69
Lines analyzed = 19959 in approximately 0.51 seconds (39128 lines/second)
Physical Source Lines of Code (SLOC) = 12701
Hits@level = [0] 132 [1]  24 [2]  23 [3]  14 [4]   7 [5]   1
Hits@level+ = [0+] 201 [1+]  69 [2+]  45 [3+]  22 [4+]   8 [5+]   1
Hits/KSLOC@level+ = [0+] 15.8255 [1+] 5.43264 [2+] 3.54303 [3+] 1.73215 [4+] 0.629872 [5+] 0.078734
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.