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/gflags-2.2.2/src/config.h
Examining data/gflags-2.2.2/src/gflags.cc
Examining data/gflags-2.2.2/src/gflags_completions.cc
Examining data/gflags-2.2.2/src/gflags_reporting.cc
Examining data/gflags-2.2.2/src/mutex.h
Examining data/gflags-2.2.2/src/util.h
Examining data/gflags-2.2.2/src/windows_port.cc
Examining data/gflags-2.2.2/src/windows_port.h
Examining data/gflags-2.2.2/test/config/main.cc
Examining data/gflags-2.2.2/test/gflags_declare_flags.cc
Examining data/gflags-2.2.2/test/gflags_declare_test.cc
Examining data/gflags-2.2.2/test/gflags_strip_flags_test.cc
Examining data/gflags-2.2.2/test/gflags_unittest.cc
Examining data/gflags-2.2.2/test/nc/gflags_nc.cc

FINAL RESULTS:

data/gflags-2.2.2/src/gflags.cc:176: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, ap);
data/gflags-2.2.2/src/gflags.cc:376:7:  [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.
      snprintf(intbuf, sizeof(intbuf), "%" PRId32, VALUE_AS(int32));
data/gflags-2.2.2/src/gflags.cc:379:7:  [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.
      snprintf(intbuf, sizeof(intbuf), "%" PRIu32, VALUE_AS(uint32));
data/gflags-2.2.2/src/gflags.cc:382:7:  [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.
      snprintf(intbuf, sizeof(intbuf), "%" PRId64, VALUE_AS(int64));
data/gflags-2.2.2/src/gflags.cc:385:7:  [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.
      snprintf(intbuf, sizeof(intbuf), "%" PRIu64, VALUE_AS(uint64));
data/gflags-2.2.2/src/util.h:282:23:  [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.
  int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap);
data/gflags-2.2.2/src/util.h:304:21:  [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.
    bytes_written = vsnprintf(buf, length, format, backup_ap);
data/gflags-2.2.2/src/windows_port.cc:63:5:  [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.
int snprintf(char *str, size_t size, const char *format, ...) {
data/gflags-2.2.2/src/windows_port.cc:67:7:  [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.
  r = vsnprintf(str, size, format, ap);
data/gflags-2.2.2/src/windows_port.h:67:28:  [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.
extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
data/gflags-2.2.2/src/windows_port.h:71:9:  [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(str, size, format, ap)  safe_vsnprintf(str, size, format, ap)
data/gflags-2.2.2/src/gflags.cc:1873: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 val = getenv(varname);
data/gflags-2.2.2/src/mutex.h:233:3:  [3] (misc) InitializeCriticalSection:
  Exceptions can be thrown in low-memory situations. Use
  InitializeCriticalSectionAndSpinCount instead.
  InitializeCriticalSection(&mutex_);
data/gflags-2.2.2/src/mutex.h:237:3:  [3] (misc) InitializeCriticalSection:
  Exceptions can be thrown in low-memory situations. Use
  InitializeCriticalSectionAndSpinCount instead.
  InitializeCriticalSection(&mutex_);
data/gflags-2.2.2/src/mutex.h:241:44:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
void Mutex::Lock()         { if (is_safe_) EnterCriticalSection(&mutex_); }
data/gflags-2.2.2/src/util.h:350: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 val = getenv(varname);
data/gflags-2.2.2/src/windows_port.h:98:10:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    if (*getenv(name) != '\0')
data/gflags-2.2.2/src/windows_port.h:99:8:  [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.
      *getenv(name) = '\0';            // works when putenv() copies nameval
data/gflags-2.2.2/src/gflags.cc:371: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 intbuf[64];    // enough to hold even the biggest number
data/gflags-2.2.2/src/gflags.cc:1017: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[kBufSize];
data/gflags-2.2.2/src/util.h:254: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 tmppath_buffer[1024];
data/gflags-2.2.2/src/util.h:275: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 space[128];    // try a small buffer and hope it fits
data/gflags-2.2.2/src/util.h:363: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(fname, mode);
data/gflags-2.2.2/test/gflags_unittest.cc:1137: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 line[8192];
data/gflags-2.2.2/test/gflags_unittest.cc:1204: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(argv, const_argv, sizeof(*argv)*(argc + 1));
data/gflags-2.2.2/src/gflags.cc:327: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).
      if (errno || end != value + strlen(value))  return false;  // bad parse
data/gflags-2.2.2/src/gflags.cc:337: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).
      if (errno || end != value + strlen(value))  return false;  // bad parse
data/gflags-2.2.2/src/gflags.cc:345: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).
      if (errno || end != value + strlen(value))  return false;  // bad parse
data/gflags-2.2.2/src/gflags.cc:353: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).
      if (errno || end != value + strlen(value))  return false;  // bad parse
data/gflags-2.2.2/src/gflags.cc:359: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).
      if (errno || end != value + strlen(value))  return false;  // bad parse
data/gflags-2.2.2/src/gflags.cc:997:13:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      len = strlen(value);
data/gflags-2.2.2/src/gflags.cc:1288: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).
                          : strlen(flagfile_contents);
data/gflags-2.2.2/src/gflags.cc:1335: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).
          space = word + strlen(word);
data/gflags-2.2.2/src/gflags_completions.cc:522: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(header) > 0) {
data/gflags-2.2.2/src/gflags_completions.cc:525: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(footer) > 0) {
data/gflags-2.2.2/src/gflags_reporting.cc:130: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).
            == strlen(c_string));  // Unless there's a \0 in there?
data/gflags-2.2.2/src/gflags_reporting.cc:252: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).
                strlen(target->c_str() + 1)) == 0)
data/gflags-2.2.2/src/windows_port.h:92: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).
  const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1;
data/gflags-2.2.2/src/windows_port.h:92:49:  [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 nameval_len = strlen(name) + 1 + strlen(value) + 1;

ANALYSIS SUMMARY:

Hits = 39
Lines analyzed = 5964 in approximately 0.17 seconds (35077 lines/second)
Physical Source Lines of Code (SLOC) = 3918
Hits@level = [0]  35 [1]  14 [2]   7 [3]   7 [4]  11 [5]   0
Hits@level+ = [0+]  74 [1+]  39 [2+]  25 [3+]  18 [4+]  11 [5+]   0
Hits/KSLOC@level+ = [0+] 18.8872 [1+] 9.95406 [2+] 6.38081 [3+] 4.59418 [4+] 2.80755 [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.