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/bubblewrap-0.4.1/bubblewrap.c
Examining data/bubblewrap-0.4.1/bind-mount.h
Examining data/bubblewrap-0.4.1/bind-mount.c
Examining data/bubblewrap-0.4.1/network.h
Examining data/bubblewrap-0.4.1/network.c
Examining data/bubblewrap-0.4.1/utils.h
Examining data/bubblewrap-0.4.1/utils.c

FINAL RESULTS:

data/bubblewrap-0.4.1/bubblewrap.c:974:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy ((char *) buffer + arg1_offset, arg1);
data/bubblewrap-0.4.1/bubblewrap.c:976:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy ((char *) buffer + arg2_offset, arg2);
data/bubblewrap-0.4.1/bubblewrap.c:1148:19:  [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 (subdir, W_OK) < 0)
data/bubblewrap-0.4.1/bubblewrap.c:2913:7:  [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.
  if (execvp (argv[0], argv) == -1)
data/bubblewrap-0.4.1/utils.c:38:3:  [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, format, args);
data/bubblewrap-0.4.1/utils.c:54:3:  [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, format, args);
data/bubblewrap-0.4.1/utils.c:262:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat (res, s1);
data/bubblewrap-0.4.1/utils.c:264:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat (res, s2);
data/bubblewrap-0.4.1/utils.c:287:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat (res, s1);
data/bubblewrap-0.4.1/utils.c:289:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat (res, s2);
data/bubblewrap-0.4.1/utils.c:291:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat (res, s3);
data/bubblewrap-0.4.1/utils.h:34:22:  [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.
#define __debug__(x) printf x
data/bubblewrap-0.4.1/utils.h:51:81:  [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.
                      ...) __attribute__((__noreturn__)) __attribute__((format (printf, 1, 2)));
data/bubblewrap-0.4.1/utils.h:53:70:  [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.
           ...) __attribute__((__noreturn__)) __attribute__((format (printf, 1, 2)));
data/bubblewrap-0.4.1/utils.h:75:47:  [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.
                  ...) __attribute__((format (printf, 1, 2)));
data/bubblewrap-0.4.1/bind-mount.c:398:19:  [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.
  resolved_dest = realpath (dest, NULL);
data/bubblewrap-0.4.1/bubblewrap.c:1369:24:  [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.
          op->source = realpath (old_source, NULL);
data/bubblewrap-0.4.1/bubblewrap.c:2824:26:  [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 *home = getenv ("HOME");
data/bubblewrap-0.4.1/bubblewrap.c:370: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 data[2];
data/bubblewrap-0.4.1/bubblewrap.c:504:16:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
      int fd = open (lock->path, O_RDONLY | O_CLOEXEC);
data/bubblewrap-0.4.1/bubblewrap.c:1286:23:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
            dest_fd = mkstemp (tempfile);
data/bubblewrap-0.4.1/bubblewrap.c:1424: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)[rec_len] = 0;
data/bubblewrap-0.4.1/bubblewrap.c:2376:13:  [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).
  proc_fd = open ("/proc", O_PATH);
data/bubblewrap-0.4.1/bubblewrap.c:2533: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.
          char b[1];
data/bubblewrap-0.4.1/bubblewrap.c:2735:32:  [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).
  { cleanup_fd int oldrootfd = open ("/", O_DIRECTORY | O_RDONLY);
data/bubblewrap-0.4.1/bubblewrap.c:2787:7:  [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 b[1];
data/bubblewrap-0.4.1/network.c:67: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[1024];
data/bubblewrap-0.4.1/network.c:140: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[1024];
data/bubblewrap-0.4.1/utils.c:469: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[BUFSIZE];
data/bubblewrap-0.4.1/utils.c:504:9:  [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).
  sfd = open (src_path, O_CLOEXEC | O_RDONLY);
data/bubblewrap-0.4.1/utils.c:693: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 buf[1] = { 0 };
data/bubblewrap-0.4.1/utils.c:697: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 control_buf_snd[control_len_snd];
data/bubblewrap-0.4.1/utils.c:735: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 recv_buf[1] = { 0 };
data/bubblewrap-0.4.1/utils.c:739: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 control_buf_rcv[control_len_rcv];
data/bubblewrap-0.4.1/bind-mount.c:45: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).
  end = escaped + strlen (escaped);
data/bubblewrap-0.4.1/bind-mount.c:106: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).
        end_token = token + strlen (token);
data/bubblewrap-0.4.1/bind-mount.c:276: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).
        next_line = line + strlen (line);
data/bubblewrap-0.4.1/bubblewrap.c:358:16:  [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 len = strlen (output);
data/bubblewrap-0.4.1/bubblewrap.c:375:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  s = TEMP_FAILURE_RETRY (read (setup_finished_fd, data, sizeof data));
data/bubblewrap-0.4.1/bubblewrap.c:451:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          s = read (event_fd, &val, 8);
data/bubblewrap-0.4.1/bubblewrap.c:465:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      s = read (signal_fd, &fdsi, sizeof (struct signalfd_siginfo));
data/bubblewrap-0.4.1/bubblewrap.c:958: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).
          buffer_size += strlen (arg1) + 1;
data/bubblewrap-0.4.1/bubblewrap.c:963: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).
          buffer_size += strlen (arg2) + 1;
data/bubblewrap-0.4.1/bubblewrap.c:981:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (read (privileged_op_socket, buffer, 1) != 1)
data/bubblewrap-0.4.1/bubblewrap.c:1049:30:  [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 (sethostname (arg1, strlen(arg1)) != 0)
data/bubblewrap-0.4.1/bubblewrap.c:1411:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rec_len = read (read_socket, buffer, buffer_size - 1);
data/bubblewrap-0.4.1/bubblewrap.c:2534:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          (void) TEMP_FAILURE_RETRY (read (opt_userns_block_fd, b, 1));
data/bubblewrap-0.4.1/bubblewrap.c:2593:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  res = read (child_wait_fd, &val, 8);
data/bubblewrap-0.4.1/bubblewrap.c:2627:15:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  old_umask = umask (0);
data/bubblewrap-0.4.1/bubblewrap.c:2788:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      (void) TEMP_FAILURE_RETRY (read (opt_block_fd, b, 1));
data/bubblewrap-0.4.1/bubblewrap.c:2807:3:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  umask (old_umask);
data/bubblewrap-0.4.1/utils.c:230: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).
  return strncmp (str, prefix, strlen (prefix)) == 0;
data/bubblewrap-0.4.1/utils.c:255:12:  [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).
    len += strlen (s1);
data/bubblewrap-0.4.1/utils.c:257:12:  [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).
    len += strlen (s2);
data/bubblewrap-0.4.1/utils.c:278:12:  [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).
    len += strlen (s1);
data/bubblewrap-0.4.1/utils.c:280:12:  [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).
    len += strlen (s2);
data/bubblewrap-0.4.1/utils.c:282:12:  [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).
    len += strlen (s3);
data/bubblewrap-0.4.1/utils.c:409:37:  [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).
    res = write_to_fd (fd, content, strlen (content));
data/bubblewrap-0.4.1/utils.c:434:37:  [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).
    res = write_to_fd (fd, content, strlen (content));
data/bubblewrap-0.4.1/utils.c:474:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      bytes_read = read (sfd, buffer, BUFSIZE);
data/bubblewrap-0.4.1/utils.c:552:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        res = read (fd, data + data_read, data_len - data_read - 1);

ANALYSIS SUMMARY:

Hits = 61
Lines analyzed = 4616 in approximately 0.17 seconds (27631 lines/second)
Physical Source Lines of Code (SLOC) = 3346
Hits@level = [0]  10 [1]  27 [2]  16 [3]   3 [4]  15 [5]   0
Hits@level+ = [0+]  71 [1+]  61 [2+]  34 [3+]  18 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 21.2194 [1+] 18.2307 [2+] 10.1614 [3+] 5.37956 [4+] 4.48296 [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.