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/bumblebee-3.2.1/src/bblogger.h
Examining data/bumblebee-3.2.1/src/bbrun.h
Examining data/bumblebee-3.2.1/src/bbsocket.c
Examining data/bumblebee-3.2.1/src/bbsocket.h
Examining data/bumblebee-3.2.1/src/bbsocketclient.c
Examining data/bumblebee-3.2.1/src/bbsocketclient.h
Examining data/bumblebee-3.2.1/src/driver.c
Examining data/bumblebee-3.2.1/src/driver.h
Examining data/bumblebee-3.2.1/src/module.h
Examining data/bumblebee-3.2.1/src/pci.c
Examining data/bumblebee-3.2.1/src/switch/sw_switcheroo.c
Examining data/bumblebee-3.2.1/src/switch/sw_bbswitch.c
Examining data/bumblebee-3.2.1/src/switch/switching.h
Examining data/bumblebee-3.2.1/src/switch/switching.c
Examining data/bumblebee-3.2.1/src/bbrun.c
Examining data/bumblebee-3.2.1/src/bblogger.c
Examining data/bumblebee-3.2.1/src/module.c
Examining data/bumblebee-3.2.1/src/bumblebeed.c
Examining data/bumblebee-3.2.1/src/pci.h
Examining data/bumblebee-3.2.1/src/bbconfig.c
Examining data/bumblebee-3.2.1/src/bbconfig.h
Examining data/bumblebee-3.2.1/src/bbsecondary.h
Examining data/bumblebee-3.2.1/src/bbsecondary.c
Examining data/bumblebee-3.2.1/src/optirun.c

FINAL RESULTS:

data/bumblebee-3.2.1/src/bblogger.c:112:19:  [5] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is high; the length parameter
  appears to be a constant, instead of computing the number of characters
  left.
    fullmsg_fmt = strncat(fullmsg_fmt, msg_format, BUFFER_SIZE);
data/bumblebee-3.2.1/src/bbsocket.c:198:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    chmod(address, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
data/bumblebee-3.2.1/src/pci.c:148:16:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
  read_bytes = readlink(path, path, sizeof(path) - 1);
data/bumblebee-3.2.1/src/bbconfig.c:87:5:  [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(*configstring, newvalue);
data/bumblebee-3.2.1/src/bbconfig.c:452:3:  [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(section, driver);
data/bumblebee-3.2.1/src/bblogger.c:114:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, fullmsg_fmt, args);
data/bumblebee-3.2.1/src/bbrun.c:207:11:  [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(ldpath_new, ldpath);
data/bumblebee-3.2.1/src/bbrun.c:209:11:  [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(ldpath_new, current_path);
data/bumblebee-3.2.1/src/bbrun.c:330:3:  [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(argv[0], argv);
data/bumblebee-3.2.1/src/bbrun.c:357:3:  [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(argv[0], argv);
data/bumblebee-3.2.1/src/bbrun.c:406: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(cmd, program_name);
data/bumblebee-3.2.1/src/bbrun.c:408:10:  [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(cmd, X_OK))
data/bumblebee-3.2.1/src/bbsocket.c:59:3:  [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(addr.sun_path, address);
data/bumblebee-3.2.1/src/optirun.c:184: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(libgl, R_OK) == 0) {
data/bumblebee-3.2.1/src/optirun.c:211:3:  [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(ldpath_new, bb_config.primus_ld_path);
data/bumblebee-3.2.1/src/optirun.c:214: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(ldpath_new, bb_config.ld_path);
data/bumblebee-3.2.1/src/optirun.c:218: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(ldpath_new, ldpath_cur);
data/bumblebee-3.2.1/src/optirun.c:282:5:  [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(ldpath_new, bb_config.ld_path);
data/bumblebee-3.2.1/src/optirun.c:285:7:  [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(ldpath_new, ldpath_cur);
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:92: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(BBSWITCH_PATH, F_OK | R_OK | W_OK) == 0) {
data/bumblebee-3.2.1/src/bbconfig.c:279:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ((opt = getopt_long(argc, argv, optString, longOpts, 0)) != -1) {
data/bumblebee-3.2.1/src/bbrun.c:202:28:  [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 *current_path = getenv("LD_LIBRARY_PATH");
data/bumblebee-3.2.1/src/bbrun.c:380: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 * env_path = getenv("PATH");
data/bumblebee-3.2.1/src/optirun.c:208:22:  [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 *ldpath_cur = getenv("LD_LIBRARY_PATH");
data/bumblebee-3.2.1/src/optirun.c:280:24:  [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 *ldpath_cur = getenv("LD_LIBRARY_PATH");
data/bumblebee-3.2.1/src/bbconfig.c:39: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.
const char *bb_pm_method_string[PM_METHODS_COUNT] = {
data/bumblebee-3.2.1/src/bbconfig.c:451:3:  [2] (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). Risk is low because the source is a constant string.
  strcpy(section, "driver-");
data/bumblebee-3.2.1/src/bbconfig.h:106:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
extern const char *bb_pm_method_string[PM_METHODS_COUNT];
data/bumblebee-3.2.1/src/bblogger.c:35:1:  [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 x_output_buffer[512]; /* Xorg output buffer */
data/bumblebee-3.2.1/src/bblogger.c:101:23:  [2] (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). Risk is low because the source is a constant string.
        fullmsg_fmt = strcpy(fullmsg_fmt, "[ERROR]");
data/bumblebee-3.2.1/src/bblogger.c:104:23:  [2] (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). Risk is low because the source is a constant string.
        fullmsg_fmt = strcpy(fullmsg_fmt, "[DEBUG]");
data/bumblebee-3.2.1/src/bblogger.c:107:23:  [2] (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). Risk is low because the source is a constant string.
        fullmsg_fmt = strcpy(fullmsg_fmt, "[WARN]");
data/bumblebee-3.2.1/src/bblogger.c:110:23:  [2] (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). Risk is low because the source is a constant string.
        fullmsg_fmt = strcpy(fullmsg_fmt, "[INFO]");
data/bumblebee-3.2.1/src/bblogger.c:137: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 error_buffer[strlen("[XORG] ") + sizeof (x_output_buffer)];
data/bumblebee-3.2.1/src/bbrun.c:220: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 devnull = open("/dev/null", O_RDWR);
data/bumblebee-3.2.1/src/bbrun.c:347: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).
  int devnull = open("/dev/null", O_RDWR);
data/bumblebee-3.2.1/src/bbrun.c:391: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 cmd[PATH_MAX];
data/bumblebee-3.2.1/src/bbrun.c:404:7:  [2] (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). Risk is low because the source is a constant string.
      strcpy(cmd, "./");
data/bumblebee-3.2.1/src/bbsecondary.c:93: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 driver[BUFFER_SIZE] = {0};
data/bumblebee-3.2.1/src/bbsecondary.c:142: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 pci_id[12];
data/bumblebee-3.2.1/src/bbsecondary.c:228: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 driver[BUFFER_SIZE];
data/bumblebee-3.2.1/src/bbsocketclient.c:42: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 buff[BUFFER_SIZE];
data/bumblebee-3.2.1/src/bumblebeed.c:110: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).
  int devnull = open("/dev/null", O_RDWR);
data/bumblebee-3.2.1/src/bumblebeed.c:169:10:  [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 buffer[BUFFER_SIZE], *conf_key;
data/bumblebee-3.2.1/src/optirun.c:68: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[BUFFER_SIZE];
data/bumblebee-3.2.1/src/optirun.c:182:7:  [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(libgl, path, part_len);
data/bumblebee-3.2.1/src/optirun.c:183:7:  [2] (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). Risk is low because the source is a constant string.
      strcpy(libgl + part_len, "/libGL.so.1");
data/bumblebee-3.2.1/src/optirun.c:242:11:  [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(libgl + pos, path, part_len);
data/bumblebee-3.2.1/src/optirun.c:319: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[BUFFER_SIZE];
data/bumblebee-3.2.1/src/pci.c:57: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 class_path[40];
data/bumblebee-3.2.1/src/pci.c:63:8:  [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(class_path, "r");
data/bumblebee-3.2.1/src/pci.c:65: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 class_buff[16];
data/bumblebee-3.2.1/src/pci.c:85: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[512];
data/bumblebee-3.2.1/src/pci.c:89:8:  [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("/proc/bus/pci/devices", "r");
data/bumblebee-3.2.1/src/pci.c:136: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 path[1024];
data/bumblebee-3.2.1/src/pci.c:175: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 config_path[41];
data/bumblebee-3.2.1/src/pci.c:180: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).
  return open(config_path, mode);
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:40: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[BBS_BUFFER];
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:42: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 * bbs = fopen(BBSWITCH_PATH, "r");
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:68:15:  [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 *bbs = fopen(BBSWITCH_PATH, "w");
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:38: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[BBS_BUFFER];
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:40: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 * bbs = fopen(SWITCHEROO_PATH, "r");
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:63: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 * bbs = fopen(SWITCHEROO_PATH, "w");
data/bumblebee-3.2.1/src/bbconfig.c:84: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).
  *configstring = malloc(strlen(newvalue) + 1);
data/bumblebee-3.2.1/src/bbconfig.c:90:101:  [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).
    bb_log(LOG_ERR, "Could not allocate %i bytes for new config value, setting to empty string!\n", strlen(newvalue) + 1);
data/bumblebee-3.2.1/src/bbconfig.c:444: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).
  section = malloc(strlen("driver-") + strlen(driver) + 1);
data/bumblebee-3.2.1/src/bbconfig.c:444: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).
  section = malloc(strlen("driver-") + strlen(driver) + 1);
data/bumblebee-3.2.1/src/bblogger.c:137: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).
  char error_buffer[strlen("[XORG] ") + sizeof (x_output_buffer)];
data/bumblebee-3.2.1/src/bblogger.c:221:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int r = read(bb_status.x_pipe[0], x_output_buffer + x_buffer_pos,
data/bumblebee-3.2.1/src/bbrun.c:205: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).
        char *ldpath_new = malloc(strlen(ldpath) + 1 + strlen(current_path) + 1);
data/bumblebee-3.2.1/src/bbrun.c:205: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).
        char *ldpath_new = malloc(strlen(ldpath) + 1 + strlen(current_path) + 1);
data/bumblebee-3.2.1/src/bbrun.c:208:11:  [1] (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). Risk is low because the
  source is a constant character.
          strcat(ldpath_new, ":");
data/bumblebee-3.2.1/src/bbrun.c:263:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000000);
data/bumblebee-3.2.1/src/bbrun.c:307:7:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
      usleep(1000000); //sleep up to a second, waiting for process
data/bumblebee-3.2.1/src/bbrun.c:309:7:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
      usleep(10000); //sleep only 10ms, because we are in a hurry
data/bumblebee-3.2.1/src/bbrun.c:379: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).
  size_t prog_len = strlen(program_name);
data/bumblebee-3.2.1/src/bbrun.c:400:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(cmd, path - path_len, path_len);
data/bumblebee-3.2.1/src/bbsecondary.c:60:18:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    pos = next + strlen(driver_keyword);
data/bumblebee-3.2.1/src/bbsecondary.c:62:17:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  path_length = strlen(x_conf_file) +
data/bumblebee-3.2.1/src/bbsecondary.c:63: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).
          driver_occurences * (strlen(driver_keyword) - 1);
data/bumblebee-3.2.1/src/bbsecondary.c:77:5:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
    strncat(path, pos, len);
data/bumblebee-3.2.1/src/bbsecondary.c:78:5:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
    strncat(path, driver, path_length);
data/bumblebee-3.2.1/src/bbsecondary.c:81:18:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    pos = next + strlen(driver_keyword);
data/bumblebee-3.2.1/src/bbsecondary.c:84:3:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
  strncat(path, pos, path_length);
data/bumblebee-3.2.1/src/bbsecondary.c:196:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(100000); //don't retry too fast
data/bumblebee-3.2.1/src/bbsocket.c:191:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(addr.sun_path, address, sizeof(addr.sun_path) - 1);
data/bumblebee-3.2.1/src/bbsocketclient.c:44: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 (!socketWrite(&bb_status.bb_socket, buff, strlen(buff) + 1)) {
data/bumblebee-3.2.1/src/bbsocketclient.c:52: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).
      if (strncmp("Value: ", buff, strlen("Value: "))) {
data/bumblebee-3.2.1/src/bbsocketclient.c:56:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(target, buff + strlen("Value: "), max_len);
data/bumblebee-3.2.1/src/bbsocketclient.c:56: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).
      strncpy(target, buff + strlen("Value: "), max_len);
data/bumblebee-3.2.1/src/bbsocketclient.c:59:11:  [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(target)) {
data/bumblebee-3.2.1/src/bbsocketclient.c:60: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).
        target[strlen(target) - 1] = 0;
data/bumblebee-3.2.1/src/bumblebeed.c:74:3:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  umask(027);
data/bumblebee-3.2.1/src/bumblebeed.c:203: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).
        socketWrite(&C->sock, buffer, strlen(buffer) + 1);
data/bumblebee-3.2.1/src/bumblebeed.c:223: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).
        socketWrite(&C->sock, buffer, strlen(buffer) + 1);
data/bumblebee-3.2.1/src/bumblebeed.c:245: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).
        socketWrite(&C->sock, buffer, strlen(buffer) + 1);
data/bumblebee-3.2.1/src/driver.c:36: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).
  } else if (strlen(CONF_DRIVER)) {
data/bumblebee-3.2.1/src/optirun.c:176:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  char *libgl = malloc(strlen(path) + sizeof("/libGL.so.1") + 1);
data/bumblebee-3.2.1/src/optirun.c:209: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).
  char *ldpath_new = malloc(strlen(bb_config.primus_ld_path) + 1 + strlen(bb_config.ld_path) + 1 +
data/bumblebee-3.2.1/src/optirun.c:209: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).
  char *ldpath_new = malloc(strlen(bb_config.primus_ld_path) + 1 + strlen(bb_config.ld_path) + 1 +
data/bumblebee-3.2.1/src/optirun.c:210:23:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        (ldpath_cur ? strlen(ldpath_cur) : 0) + 1);
data/bumblebee-3.2.1/src/optirun.c:213:5:  [1] (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). Risk is low because the
  source is a constant character.
    strcat(ldpath_new, ":");
data/bumblebee-3.2.1/src/optirun.c:217:5:  [1] (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). Risk is low because the
  source is a constant character.
    strcat(ldpath_new, ":");
data/bumblebee-3.2.1/src/optirun.c:226:22:  [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 libgl_size = strlen(bb_config.ld_path) + 1;
data/bumblebee-3.2.1/src/optirun.c:281:31:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    char *ldpath_new = malloc(strlen(bb_config.ld_path) + 1 + (ldpath_cur ? strlen(ldpath_cur) : 0) + 1);
data/bumblebee-3.2.1/src/optirun.c:281:77:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    char *ldpath_new = malloc(strlen(bb_config.ld_path) + 1 + (ldpath_cur ? strlen(ldpath_cur) : 0) + 1);
data/bumblebee-3.2.1/src/optirun.c:284:7:  [1] (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). Risk is low because the
  source is a constant character.
      strcat(ldpath_new, ":");
data/bumblebee-3.2.1/src/pci.c:160:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(dest, name, len - 1);
data/bumblebee-3.2.1/src/pci.c:164:10:  [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 strlen(name);
data/bumblebee-3.2.1/src/pci.c:199:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (read(fd, &pcs->saved_config_space[i], 4) != 4) {
data/bumblebee-3.2.1/src/pci.c:251:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (read(fd_read, &val, 4) == 0) {
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:48:18:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  if (fseek(bbs, strlen("0000:00:00.0 O"), SEEK_SET) != -1) {
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:49:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    switch (fgetc(bbs)) {
data/bumblebee-3.2.1/src/switch/sw_bbswitch.c:73: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).
  fwrite(msg, sizeof msg, strlen(msg) + 1, bbs);
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:45: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(buffer) > strlen("0:DIS: :Pwr") &&
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:45: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).
    if (strlen(buffer) > strlen("0:DIS: :Pwr") &&
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:48:22:  [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).
      switch (buffer[strlen("0:DIS: :")]) {
data/bumblebee-3.2.1/src/switch/sw_switcheroo.c:69: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).
  fwrite(msg, sizeof msg, strlen(msg) + 1, bbs);

ANALYSIS SUMMARY:

Hits = 118
Lines analyzed = 4448 in approximately 0.19 seconds (23927 lines/second)
Physical Source Lines of Code (SLOC) = 2779
Hits@level = [0]  35 [1]  55 [2]  38 [3]   5 [4]  17 [5]   3
Hits@level+ = [0+] 153 [1+] 118 [2+]  63 [3+]  25 [4+]  20 [5+]   3
Hits/KSLOC@level+ = [0+] 55.0558 [1+] 42.4613 [2+] 22.67 [3+] 8.99604 [4+] 7.19683 [5+] 1.07953
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.