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/google-glog-0.4.0/bazel/example/main.cc Examining data/google-glog-0.4.0/src/base/commandlineflags.h Examining data/google-glog-0.4.0/src/base/googleinit.h Examining data/google-glog-0.4.0/src/base/mutex.h Examining data/google-glog-0.4.0/src/config_for_unittests.h Examining data/google-glog-0.4.0/src/demangle.cc Examining data/google-glog-0.4.0/src/demangle.h Examining data/google-glog-0.4.0/src/demangle_unittest.cc Examining data/google-glog-0.4.0/src/glog/log_severity.h Examining data/google-glog-0.4.0/src/logging.cc Examining data/google-glog-0.4.0/src/logging_striptest10.cc Examining data/google-glog-0.4.0/src/logging_striptest2.cc Examining data/google-glog-0.4.0/src/logging_striptest_main.cc Examining data/google-glog-0.4.0/src/mock-log.h Examining data/google-glog-0.4.0/src/mock-log_test.cc Examining data/google-glog-0.4.0/src/raw_logging.cc Examining data/google-glog-0.4.0/src/signalhandler.cc Examining data/google-glog-0.4.0/src/signalhandler_unittest.cc Examining data/google-glog-0.4.0/src/stacktrace.h Examining data/google-glog-0.4.0/src/stacktrace_generic-inl.h Examining data/google-glog-0.4.0/src/stacktrace_libunwind-inl.h Examining data/google-glog-0.4.0/src/stacktrace_powerpc-inl.h Examining data/google-glog-0.4.0/src/stacktrace_unittest.cc Examining data/google-glog-0.4.0/src/stacktrace_windows-inl.h Examining data/google-glog-0.4.0/src/stacktrace_x86-inl.h Examining data/google-glog-0.4.0/src/stacktrace_x86_64-inl.h Examining data/google-glog-0.4.0/src/stl_logging_unittest.cc Examining data/google-glog-0.4.0/src/symbolize.cc Examining data/google-glog-0.4.0/src/symbolize.h Examining data/google-glog-0.4.0/src/utilities.cc Examining data/google-glog-0.4.0/src/utilities_unittest.cc Examining data/google-glog-0.4.0/src/vlog_is_on.cc Examining data/google-glog-0.4.0/src/windows/config.h Examining data/google-glog-0.4.0/src/windows/glog/log_severity.h Examining data/google-glog-0.4.0/src/windows/glog/logging.h Examining data/google-glog-0.4.0/src/windows/glog/raw_logging.h Examining data/google-glog-0.4.0/src/windows/glog/stl_logging.h Examining data/google-glog-0.4.0/src/windows/glog/vlog_is_on.h Examining data/google-glog-0.4.0/src/windows/port.cc Examining data/google-glog-0.4.0/src/windows/port.h Examining data/google-glog-0.4.0/src/utilities.h Examining data/google-glog-0.4.0/src/googletest.h Examining data/google-glog-0.4.0/src/logging_unittest.cc Examining data/google-glog-0.4.0/src/symbolize_unittest.cc FINAL RESULTS: data/google-glog-0.4.0/src/googletest.h:513:9: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(diffcmd.c_str()) != 0) { data/google-glog-0.4.0/src/logging.cc:84:12: [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. using std::fprintf; data/google-glog-0.4.0/src/logging.cc:1809:18: [4] (shell) popen: 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. FILE* pipe = popen(cmd.c_str(), "w"); data/google-glog-0.4.0/src/logging.cc:1927: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(i_dir->c_str(), 0) ) { data/google-glog-0.4.0/src/raw_logging.cc:82:11: [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 n = vsnprintf(*buf, *size, format, ap); data/google-glog-0.4.0/src/raw_logging.cc:93:11: [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 n = vsnprintf(*buf, *size, format, ap); data/google-glog-0.4.0/src/symbolize.cc:847:7: [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(out, info.dli_sname); data/google-glog-0.4.0/src/windows/glog/logging.h:111:68: [4] (shell) system: 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. #error Do not know how to define a 32-bit integer quantity on your system data/google-glog-0.4.0/src/windows/port.cc:58: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/google-glog-0.4.0/src/windows/port.cc:61:17: [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 r = vsnprintf(str, size, format, ap); data/google-glog-0.4.0/src/windows/port.h:81:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. #define access _access data/google-glog-0.4.0/src/windows/port.h:88:9: [4] (shell) popen: 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. #define popen _popen data/google-glog-0.4.0/src/windows/port.h:123:33: [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 int GOOGLE_GLOG_DLL_DECL snprintf(char *str, size_t size, data/google-glog-0.4.0/src/windows/port.h:128: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/google-glog-0.4.0/src/base/commandlineflags.h:125:5: [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(envname) ? (dflt) : getenv(envname)) data/google-glog-0.4.0/src/base/commandlineflags.h:125:32: [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(envname) ? (dflt) : getenv(envname)) data/google-glog-0.4.0/src/base/commandlineflags.h:128:5: [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(envname) ? (dflt) : memchr("tTyY1\0", getenv(envname)[0], 6) != NULL) data/google-glog-0.4.0/src/base/commandlineflags.h:128:50: [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(envname) ? (dflt) : memchr("tTyY1\0", getenv(envname)[0], 6) != NULL) data/google-glog-0.4.0/src/base/commandlineflags.h:131:5: [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(envname) ? (dflt) : strtol(getenv(envname), NULL, 10)) data/google-glog-0.4.0/src/base/commandlineflags.h:131:39: [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(envname) ? (dflt) : strtol(getenv(envname), NULL, 10)) data/google-glog-0.4.0/src/base/mutex.h:228:30: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); } data/google-glog-0.4.0/src/base/mutex.h:230: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/google-glog-0.4.0/src/logging.cc:99:30: [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 valstr = getenv(varname); data/google-glog-0.4.0/src/logging.cc:152: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. env = getenv("GOOGLE_LOG_DIR"); data/google-glog-0.4.0/src/logging.cc:156: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. env = getenv("TEST_TMPDIR"); data/google-glog-0.4.0/src/logging.cc:251: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. const char* const term = getenv("TERM"); data/google-glog-0.4.0/src/logging.cc:1859:5: [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("TEST_TMPDIR"), data/google-glog-0.4.0/src/logging.cc:1862:5: [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("TMPDIR"), getenv("TMP"), data/google-glog-0.4.0/src/logging.cc:1862:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. getenv("TMPDIR"), getenv("TMP"), data/google-glog-0.4.0/src/utilities.cc:301: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. const char* user = getenv("USERNAME"); data/google-glog-0.4.0/src/utilities.cc:303: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. const char* user = getenv("USER"); data/google-glog-0.4.0/src/demangle.cc:1337:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1024]; // Big enough for a sane symbol. data/google-glog-0.4.0/src/demangle_unittest.cc:57: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 demangled[4096]; data/google-glog-0.4.0/src/demangle_unittest.cc:84: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 tmp[size] = { 0 }; data/google-glog-0.4.0/src/demangle_unittest.cc:103: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 tmp[20]; data/google-glog-0.4.0/src/googletest.h:78: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 tmp[MAX_PATH]; data/google-glog-0.4.0/src/googletest.h:296:18: [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 cap_fd = open(filename_.c_str(), data/google-glog-0.4.0/src/googletest.h:374:23: [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 * const file = fopen(cap->filename().c_str(), "r"); data/google-glog-0.4.0/src/googletest.h:457: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(filename.c_str(), "rb"); data/google-glog-0.4.0/src/googletest.h:459: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[4096]; data/google-glog-0.4.0/src/googletest.h:463: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 null_str[256]; data/google-glog-0.4.0/src/googletest.h:464: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 ptr_str[256]; data/google-glog-0.4.0/src/googletest.h:465:5: [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(null_str, "%p", static_cast<void*>(NULL)); data/google-glog-0.4.0/src/googletest.h:466:5: [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(ptr_str, "%p", reinterpret_cast<void*>(PTR_TEST_VALUE)); data/google-glog-0.4.0/src/googletest.h:487: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(file.c_str(), "wb"); data/google-glog-0.4.0/src/logging.cc:229: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[MAX_COMPUTERNAME_LENGTH + 1]; data/google-glog-0.4.0/src/logging.cc:340: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 message_text_[LogMessage::kMaxLogMessageLen+1]; data/google-glog-0.4.0/src/logging.cc:909: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). int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, FLAGS_logfile_mode); data/google-glog-0.4.0/src/logging.cc:1163: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 thread_msg_data[sizeof(void*) + sizeof(LogMessage::LogMessageData)]; data/google-glog-0.4.0/src/logging.cc:1298: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 fileline[128]; data/google-glog-0.4.0/src/logging.cc:1391:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char fatal_message[256]; data/google-glog-0.4.0/src/logging.cc:1469: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(fatal_message, data_->message_text_, copy); data/google-glog-0.4.0/src/logging.cc:1849: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 tmp[MAX_PATH]; data/google-glog-0.4.0/src/logging.cc:1902:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[MAX_PATH]; data/google-glog-0.4.0/src/logging.cc:1939: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 copybuf[kCopyBlockSize]; data/google-glog-0.4.0/src/logging.cc:1949: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). int fd = open(path, flags); data/google-glog-0.4.0/src/logging.cc:2096: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[100]; data/google-glog-0.4.0/src/logging_unittest.cc:678: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(files[0].c_str(), "r"); data/google-glog-0.4.0/src/logging_unittest.cc:680: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[1000]; data/google-glog-0.4.0/src/logging_unittest.cc:787:18: [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). CHECK_ERR(fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0600)); data/google-glog-0.4.0/src/logging_unittest.cc:863:18: [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). CHECK_ERR(fd = open(path.c_str(), O_APPEND | O_WRONLY)); data/google-glog-0.4.0/src/logging_unittest.cc:864: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 fdpath[64]; data/google-glog-0.4.0/src/logging_unittest.cc:1198: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 where[100]; data/google-glog-0.4.0/src/raw_logging.cc:103:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char crash_buf[kLogBufSize + 1] = { 0 }; // Will end in '\0' data/google-glog-0.4.0/src/raw_logging.cc:112: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[kLogBufSize]; data/google-glog-0.4.0/src/raw_logging.cc:144: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(crash_buf, msg_start, msg_size); // Don't include prefix data/google-glog-0.4.0/src/signalhandler.cc:161: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[256]; // Big enough for time info. data/google-glog-0.4.0/src/signalhandler.cc:185: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[256]; // Big enough for signal info. data/google-glog-0.4.0/src/signalhandler.cc:226: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 symbolized[1024]; // Big enough for a sane symbol. data/google-glog-0.4.0/src/signalhandler.cc:234: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]; // Big enough for stack frame info. data/google-glog-0.4.0/src/stl_logging_unittest.cc:138:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[256]; data/google-glog-0.4.0/src/stl_logging_unittest.cc:139:7: [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(buf, "%d", i); data/google-glog-0.4.0/src/symbolize.cc:98: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 demangled[256]; // Big enough for sane demangled symbols. data/google-glog-0.4.0/src/symbolize.cc:246: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 header_name[kMaxSectionNameLen]; data/google-glog-0.4.0/src/symbolize.cc:517:21: [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). NO_INTR(maps_fd = open("/proc/self/maps", O_RDONLY)); data/google-glog-0.4.0/src/symbolize.cc:524:20: [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). NO_INTR(mem_fd = open("/proc/self/mem", O_RDONLY)); data/google-glog-0.4.0/src/symbolize.cc:532: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]; // Big enough for line of sane /proc/self/maps data/google-glog-0.4.0/src/symbolize.cc:650:25: [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). NO_INTR(object_fd = open(cursor, O_RDONLY)); data/google-glog-0.4.0/src/symbolize.cc:748: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[17] = {'\0'}; data/google-glog-0.4.0/src/symbolize.cc:902: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[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; data/google-glog-0.4.0/src/symbolize_unittest.cc:58: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 symbol[4096]; data/google-glog-0.4.0/src/symbolize_unittest.cc:152:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char g_symbolize_buffer[4096]; data/google-glog-0.4.0/src/symbolize_unittest.cc:206: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 altstack[kAlternateStackSize]; data/google-glog-0.4.0/src/utilities.cc:101: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 tmp[1024]; data/google-glog-0.4.0/src/utilities.cc:109: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/google-glog-0.4.0/src/utilities.cc:118: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[100]; data/google-glog-0.4.0/src/utilities.cc:311: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[1024] = {'\0'}; data/google-glog-0.4.0/src/windows/glog/logging.h:1617: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 message_buffer_[2]; data/google-glog-0.4.0/src/windows/port.h:83:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). #define open _open data/google-glog-0.4.0/src/demangle.cc:1343:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, lparen + 1, length); data/google-glog-0.4.0/src/googletest.h:593:3: [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(t * 1000); data/google-glog-0.4.0/src/logging.cc:195:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t len = read(fd, buf, count); data/google-glog-0.4.0/src/logging.cc:1395:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const int n = strlen(fatal_message); data/google-glog-0.4.0/src/logging.cc:1418: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). WriteToStderr(w, strlen(w)); data/google-glog-0.4.0/src/logging.cc:1490: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). if (write(STDERR_FILENO, message, strlen(message)) < 0) { data/google-glog-0.4.0/src/logging.cc:1813: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). fwrite(body, sizeof(char), strlen(body), pipe); data/google-glog-0.4.0/src/logging.cc:1946: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(procfd_prefix, path, strlen(procfd_prefix))) flags |= O_NOFOLLOW; data/google-glog-0.4.0/src/logging.cc:2089:7: [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(buf, rc, len-1); data/google-glog-0.4.0/src/logging_unittest.cc:790: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). const size_t discard_size = strlen(discardstr), keep_size = strlen(keepstr); data/google-glog-0.4.0/src/logging_unittest.cc:790:63: [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 discard_size = strlen(discardstr), keep_size = strlen(keepstr); data/google-glog-0.4.0/src/logging_unittest.cc:818:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). CHECK_ERR(read(fd, buf, buf_size)); data/google-glog-0.4.0/src/logging_unittest.cc:1066: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 buf_size = strlen(msg) + 1; data/google-glog-0.4.0/src/raw_logging.cc:139:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). safe_write(STDERR_FILENO, buffer, strlen(buffer)); data/google-glog-0.4.0/src/symbolize.cc:101: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). size_t len = strlen(demangled); data/google-glog-0.4.0/src/symbolize.cc:654:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out_file_name, cursor, out_file_name_size); data/google-glog-0.4.0/src/symbolize.cc:734:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int dest_string_length = strlen(dest); data/google-glog-0.4.0/src/symbolize.cc:738:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, source, dest_size); data/google-glog-0.4.0/src/symbolize.cc:846: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). if ((int)strlen(info.dli_sname) < out_size) { data/google-glog-0.4.0/src/symbolize.cc:912:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out, symbol->Name, static_cast<size_t>(symbol->NameLen) + 1); data/google-glog-0.4.0/src/utilities.cc:88:34: [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 (write(STDERR_FILENO, data, strlen(data)) < 0) { data/google-glog-0.4.0/src/vlog_is_on.cc:169: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). int const pattern_len = strlen(module_pattern); data/google-glog-0.4.0/src/vlog_is_on.cc:222:61: [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 base_length = base_end ? size_t(base_end - base) : strlen(base); data/google-glog-0.4.0/src/windows/port.h:84:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read _read ANALYSIS SUMMARY: Hits = 113 Lines analyzed = 13520 in approximately 0.33 seconds (40735 lines/second) Physical Source Lines of Code (SLOC) = 8110 Hits@level = [0] 53 [1] 24 [2] 58 [3] 17 [4] 14 [5] 0 Hits@level+ = [0+] 166 [1+] 113 [2+] 89 [3+] 31 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 20.4686 [1+] 13.9334 [2+] 10.9741 [3+] 3.82244 [4+] 1.72626 [5+] 0 Dot directories skipped = 2 (--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.