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/xorg-gtest-0.7.1/include/xorg/gtest/xorg-gtest-test.h
Examining data/xorg-gtest-0.7.1/include/xorg/gtest/xorg-gtest-environment.h
Examining data/xorg-gtest-0.7.1/include/xorg/gtest/xorg-gtest-xserver.h
Examining data/xorg-gtest-0.7.1/include/xorg/gtest/xorg-gtest.h
Examining data/xorg-gtest-0.7.1/include/xorg/gtest/evemu/xorg-gtest-device.h
Examining data/xorg-gtest-0.7.1/include/xorg/gtest/xorg-gtest-process.h
Examining data/xorg-gtest-0.7.1/gtest/include/gtest/gtest-spi.h
Examining data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h
Examining data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc
Examining data/xorg-gtest-0.7.1/gtest/src/gtest_main.cc
Examining data/xorg-gtest-0.7.1/examples/xorg-gtest-example.cpp
Examining data/xorg-gtest-0.7.1/examples/xorg-gtest-environment-example.cpp
Examining data/xorg-gtest-0.7.1/src/test.cpp
Examining data/xorg-gtest-0.7.1/src/defines.h
Examining data/xorg-gtest-0.7.1/src/xorg-gtest-all.cpp
Examining data/xorg-gtest-0.7.1/src/environment.cpp
Examining data/xorg-gtest-0.7.1/src/device.cpp
Examining data/xorg-gtest-0.7.1/src/process.cpp
Examining data/xorg-gtest-0.7.1/src/xorg-gtest_main.cpp
Examining data/xorg-gtest-0.7.1/src/xserver.cpp
Examining data/xorg-gtest-0.7.1/test/xserver-test.cpp
Examining data/xorg-gtest-0.7.1/test/xserver-test-helper.cpp
Examining data/xorg-gtest-0.7.1/test/process-test-helper.cpp
Examining data/xorg-gtest-0.7.1/test/device-test.cpp
Examining data/xorg-gtest-0.7.1/test/process-test.cpp

FINAL RESULTS:

data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2671:20:  [4] (buffer) StrNCpy:
  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).
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:8110:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf(\
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:1440:10:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define vsnprintf _vsnprintf
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2144:12:  [4] (buffer) StrNCpy:
  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).
    posix::StrNCpy(clone, str, length);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2764:12:  [4] (buffer) StrNCpy:
  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).
    posix::StrNCpy(
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3017:20:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  const int size = vsnprintf(buffer, kBufferSize, format, args);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3021:20:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  const int size = vsnprintf(buffer, kBufferSize, format, args);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3938:5:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vprintf(fmt, args);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3957:3:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  vprintf(fmt, args);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3964:3:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  vprintf(fmt, args);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8605:10:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define snprintf _snprintf
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8605:19:  [4] (format) _snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define snprintf _snprintf
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8607:10:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define snprintf _snprintf_s
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8609:10:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define snprintf _snprintf
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8609:19:  [4] (format) _snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
# define snprintf _snprintf
data/xorg-gtest-0.7.1/src/process.cpp:118:5:  [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(args[0], &args[0]);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2709: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 char* const env = getenv(name);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2712: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.
  return getenv(name);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:17891:39:  [3] (random) random:
  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.
  void ShuffleTests(internal::Random* random);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:700:37:  [3] (random) random:
  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.
void ShuffleRange(internal::Random* random, int begin, int end,
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:721:39:  [3] (random) random:
  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.
inline void Shuffle(internal::Random* random, std::vector<E>* v) {
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:722:16:  [3] (random) random:
  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.
  ShuffleRange(random, 0, static_cast<int>(v->size()), v);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:1172:21:  [3] (random) random:
  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.
  internal::Random* random() { return &random_; }
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3767:47:  [3] (random) random:
  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.
void TestCase::ShuffleTests(internal::Random* random) {
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3768:11:  [3] (random) random:
  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.
  Shuffle(random, &test_indices_);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:5519:7:  [3] (random) random:
  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.
      random()->Reseed(random_seed_);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:5790:16:  [3] (random) random:
  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.
  ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:5793:16:  [3] (random) random:
  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.
  ShuffleRange(random(), last_death_test_case_ + 1,
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:5798:34:  [3] (random) random:
  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.
    test_cases_[i]->ShuffleTests(random());
data/xorg-gtest-0.7.1/src/process.cpp:79: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("XORG_GTEST_CHILD_STDOUT") == NULL) {
data/xorg-gtest-0.7.1/src/process.cpp:103: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 *valgrind = getenv("XORG_GTEST_USE_VALGRIND");
data/xorg-gtest-0.7.1/src/process.cpp:245: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.
  const char* var = getenv(name.c_str());
data/xorg-gtest-0.7.1/src/xorg-gtest_main.cpp:135:11:  [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.
    ret = getopt_long(argc, argv, "", longopts, &index);
data/xorg-gtest-0.7.1/src/xserver.cpp:486: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("XORG_GTEST_XSERVER_KEEPALIVE"))
data/xorg-gtest-0.7.1/src/xserver.cpp:524: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 *sleepwait = getenv("XORG_GTEST_XSERVER_SIGSTOP");
data/xorg-gtest-0.7.1/src/xserver.cpp:552:7:  [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("XORG_GTEST_XSERVER_KEEPALIVE"))
data/xorg-gtest-0.7.1/src/xserver.cpp:564:7:  [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("XORG_GTEST_XSERVER_KEEPALIVE"))
data/xorg-gtest-0.7.1/test/xserver-test.cpp:304:17:  [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.
    ASSERT_TRUE(getenv("XORG_GTEST_XSERVER_KEEPALIVE") != NULL);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2683: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).
  return fopen(path, mode);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:3154: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(str, buffer, a_length);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2167:7:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
      MultiByteToWideChar(CP_ACP, 0, ansi, length,
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2170:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar(CP_ACP, 0, ansi, length,
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2658: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_text[kBufSize] = { '\0' };
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2826: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[32];  // CodePointToUtf8 requires a buffer this big.
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:3008: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[4096];
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:6471: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[256];
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:6890: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 executable_path[_MAX_PATH + 1];  // NOLINT
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:7534: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 cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:7537: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 cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8218:3:  [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(buffer, regex, len);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8296: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 temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8297: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 temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8315:29:  [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).
    const int captured_fd = mkstemp(name_template);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8615: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 text[5] = "";
data/xorg-gtest-0.7.1/src/device.cpp:71: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 device_name[256];
data/xorg-gtest-0.7.1/src/device.cpp:73: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).
    int fd = open(path.c_str(), O_RDONLY);
data/xorg-gtest-0.7.1/src/device.cpp:124: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[1024];
data/xorg-gtest-0.7.1/src/device.cpp:165: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).
  FILE* fp = fopen(path.c_str(), "r");
data/xorg-gtest-0.7.1/src/device.cpp:187:12:  [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).
  d_->fd = open(UINPUT_NODE, O_WRONLY);
data/xorg-gtest-0.7.1/src/device.cpp:209: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* file = fopen(path.c_str(), "r");
data/xorg-gtest-0.7.1/src/xorg-gtest_main.cpp:149: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).
        xorg_display = atoi(optarg);
data/xorg-gtest-0.7.1/src/xserver.cpp:197: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(m->mask, masks[i].mask, masks[i].mask_len);
data/xorg-gtest-0.7.1/src/xserver.cpp:343: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).
  file_test.open(log.c_str());
data/xorg-gtest-0.7.1/src/xserver.cpp:347:12:  [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).
  log_test.open(log.c_str(), std::ofstream::out);
data/xorg-gtest-0.7.1/src/xserver.cpp:356: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).
  file_test.open(old_log_file.c_str());
data/xorg-gtest-0.7.1/src/xserver.cpp:359:12:  [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).
  log_test.open(old_log_file.c_str(), std::ofstream::out);
data/xorg-gtest-0.7.1/src/xserver.cpp:372:11:  [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).
  logfile.open(d_->options["-logfile"].c_str());
data/xorg-gtest-0.7.1/test/process-test.cpp:103: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[20] = {0};
data/xorg-gtest-0.7.1/test/process-test.cpp:107:23:  [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).
    pid_t child_pid = atoi(buffer);
data/xorg-gtest-0.7.1/test/process-test.cpp:307: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[1024] = {0};
data/xorg-gtest-0.7.1/test/process-test.cpp:308: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 fname[128];
data/xorg-gtest-0.7.1/test/process-test.cpp:309:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(fname, "/proc/%d/comm", p.Pid());
data/xorg-gtest-0.7.1/test/process-test.cpp:312: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(fname, "r");
data/xorg-gtest-0.7.1/test/process-test.cpp:348: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[1024] = {0};
data/xorg-gtest-0.7.1/test/process-test.cpp:349: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 fname[128];
data/xorg-gtest-0.7.1/test/process-test.cpp:350:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(fname, "/proc/%d/cmdline", p.Pid());
data/xorg-gtest-0.7.1/test/process-test.cpp:353: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(fname, "r");
data/xorg-gtest-0.7.1/test/xserver-test.cpp:39:8:  [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).
  file.open(logfile.c_str());
data/xorg-gtest-0.7.1/test/xserver-test.cpp:44:8:  [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).
  file.open(logfile.c_str());
data/xorg-gtest-0.7.1/test/xserver-test.cpp:51:8:  [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).
  file.open(logfile.c_str());
data/xorg-gtest-0.7.1/test/xserver-test.cpp:56:8:  [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).
  file.open(logfile.c_str());
data/xorg-gtest-0.7.1/test/xserver-test.cpp:339: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[20] = {0};
data/xorg-gtest-0.7.1/test/xserver-test.cpp:346:22:  [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).
  pid_t server_pid = atoi(buffer);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2672:10:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  return strncpy(dest, src, n);
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:2694:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  return static_cast<int>(read(fd, buf, count));
data/xorg-gtest-0.7.1/gtest/include/gtest/gtest.h:3050:33:  [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).
      ConstructNonNull(a_c_str, strlen(a_c_str));
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2155: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).
                    NULL : CloneString(c_str, strlen(c_str));
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2165: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).
  const int length = strlen(ansi);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2810:34:  [1] (buffer) wcslen:
  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).
    num_chars = static_cast<int>(wcslen(str));
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2975: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).
  const size_t this_len = strlen(c_str());
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2976: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).
  const size_t suffix_len = strlen(suffix);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2988: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).
  const size_t this_len = strlen(c_str());
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:2989: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).
  const size_t suffix_len = strlen(suffix);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:4517: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).
      segment = next_segment + strlen("]]>");
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:4746: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).
  result.reserve(strlen(str) + 1);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:5851: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).
  const size_t prefix_len = strlen(prefix);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:7952:33:  [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).
  const size_t full_regex_len = strlen(regex) + 10;
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8206: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).
  const size_t len = strlen(regex);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8854: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).
    PrintCharsAsStringTo(s, strlen(s), os);
data/xorg-gtest-0.7.1/gtest/src/gtest-all.cc:8871:33:  [1] (buffer) wcslen:
  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).
    PrintWideCharsAsStringTo(s, wcslen(s), os);
data/xorg-gtest-0.7.1/src/device.cpp:88:12:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    return equal;
data/xorg-gtest-0.7.1/src/device.cpp:130:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    r = read(fd, buf + bufidx, sizeof(buf) - bufidx);
data/xorg-gtest-0.7.1/src/process.cpp:160: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(timeout * 1000);
data/xorg-gtest-0.7.1/src/process.cpp:168: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(timeout * 1000);
data/xorg-gtest-0.7.1/test/process-test.cpp:50: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(5000);
data/xorg-gtest-0.7.1/test/process-test.cpp:70: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(500);
data/xorg-gtest-0.7.1/test/process-test.cpp:96: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).
    ASSERT_EQ(write(pipefd[1], buffer, strlen(buffer)), (int)strlen(buffer));
data/xorg-gtest-0.7.1/test/process-test.cpp:96:62:  [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).
    ASSERT_EQ(write(pipefd[1], buffer, strlen(buffer)), (int)strlen(buffer));
data/xorg-gtest-0.7.1/test/process-test.cpp:104:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ASSERT_GT(read(pipefd[0], buffer, sizeof(buffer)), 0);
data/xorg-gtest-0.7.1/test/process-test.cpp:110: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(100);
data/xorg-gtest-0.7.1/test/process-test.cpp:359: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).
  const char * arg = buff + strlen(buff) + 1;
data/xorg-gtest-0.7.1/test/process-test.cpp:364: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).
      arg += strlen(arg) + 1;
data/xorg-gtest-0.7.1/test/process-test.cpp:366: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).
    arg += strlen(arg) + 1;
data/xorg-gtest-0.7.1/test/process-test.cpp:373: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).
  while(strlen(arg) && it != valgrind_args.end()) {
data/xorg-gtest-0.7.1/test/process-test.cpp:375: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).
    arg += strlen(arg) + 1;
data/xorg-gtest-0.7.1/test/xserver-test.cpp:36: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(5000);
data/xorg-gtest-0.7.1/test/xserver-test.cpp:324: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).
    ASSERT_EQ(write(pipefd[1], buffer, strlen(buffer)), (int)strlen(buffer));
data/xorg-gtest-0.7.1/test/xserver-test.cpp:324:62:  [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).
    ASSERT_EQ(write(pipefd[1], buffer, strlen(buffer)), (int)strlen(buffer));
data/xorg-gtest-0.7.1/test/xserver-test.cpp:340:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  ASSERT_GT(read(pipefd[0], buffer, sizeof(buffer)), 0);
data/xorg-gtest-0.7.1/test/xserver-test.cpp:355: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(50000);
data/xorg-gtest-0.7.1/test/xserver-test.cpp:370: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(50000);

ANALYSIS SUMMARY:

Hits = 121
Lines analyzed = 32810 in approximately 0.77 seconds (42429 lines/second)
Physical Source Lines of Code (SLOC) = 20504
Hits@level = [0]  58 [1]  38 [2]  45 [3]  22 [4]  16 [5]   0
Hits@level+ = [0+] 179 [1+] 121 [2+]  83 [3+]  38 [4+]  16 [5+]   0
Hits/KSLOC@level+ = [0+] 8.73 [1+] 5.90129 [2+] 4.04799 [3+] 1.8533 [4+] 0.780336 [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.