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-perftools-2.8/benchmark/binary_trees.cc Examining data/google-perftools-2.8/benchmark/malloc_bench.cc Examining data/google-perftools-2.8/benchmark/run_benchmark.c Examining data/google-perftools-2.8/benchmark/run_benchmark.h Examining data/google-perftools-2.8/src/addressmap-inl.h Examining data/google-perftools-2.8/src/base/arm_instruction_set_select.h Examining data/google-perftools-2.8/src/base/atomicops-internals-arm-generic.h Examining data/google-perftools-2.8/src/base/atomicops-internals-arm-v6plus.h Examining data/google-perftools-2.8/src/base/atomicops-internals-gcc.h Examining data/google-perftools-2.8/src/base/atomicops-internals-linuxppc.h Examining data/google-perftools-2.8/src/base/atomicops-internals-macosx.h Examining data/google-perftools-2.8/src/base/atomicops-internals-mips.h Examining data/google-perftools-2.8/src/base/atomicops-internals-windows.h Examining data/google-perftools-2.8/src/base/atomicops-internals-x86.cc Examining data/google-perftools-2.8/src/base/atomicops-internals-x86.h Examining data/google-perftools-2.8/src/base/atomicops.h Examining data/google-perftools-2.8/src/base/basictypes.h Examining data/google-perftools-2.8/src/base/commandlineflags.h Examining data/google-perftools-2.8/src/base/dynamic_annotations.c Examining data/google-perftools-2.8/src/base/dynamic_annotations.h Examining data/google-perftools-2.8/src/base/elf_mem_image.cc Examining data/google-perftools-2.8/src/base/elf_mem_image.h Examining data/google-perftools-2.8/src/base/elfcore.h Examining data/google-perftools-2.8/src/base/googleinit.h Examining data/google-perftools-2.8/src/base/linux_syscall_support.h Examining data/google-perftools-2.8/src/base/linuxthreads.cc Examining data/google-perftools-2.8/src/base/linuxthreads.h Examining data/google-perftools-2.8/src/base/logging.cc Examining data/google-perftools-2.8/src/base/logging.h Examining data/google-perftools-2.8/src/base/low_level_alloc.cc Examining data/google-perftools-2.8/src/base/low_level_alloc.h Examining data/google-perftools-2.8/src/base/simple_mutex.h Examining data/google-perftools-2.8/src/base/spinlock.cc Examining data/google-perftools-2.8/src/base/spinlock.h Examining data/google-perftools-2.8/src/base/spinlock_internal.cc Examining data/google-perftools-2.8/src/base/spinlock_internal.h Examining data/google-perftools-2.8/src/base/spinlock_linux-inl.h Examining data/google-perftools-2.8/src/base/spinlock_posix-inl.h Examining data/google-perftools-2.8/src/base/spinlock_win32-inl.h Examining data/google-perftools-2.8/src/base/stl_allocator.h Examining data/google-perftools-2.8/src/base/sysinfo.cc Examining data/google-perftools-2.8/src/base/sysinfo.h Examining data/google-perftools-2.8/src/base/thread_annotations.h Examining data/google-perftools-2.8/src/base/thread_lister.c Examining data/google-perftools-2.8/src/base/thread_lister.h Examining data/google-perftools-2.8/src/base/vdso_support.cc Examining data/google-perftools-2.8/src/base/vdso_support.h Examining data/google-perftools-2.8/src/central_freelist.cc Examining data/google-perftools-2.8/src/central_freelist.h Examining data/google-perftools-2.8/src/common.cc Examining data/google-perftools-2.8/src/common.h Examining data/google-perftools-2.8/src/config_for_unittests.h Examining data/google-perftools-2.8/src/debugallocation.cc Examining data/google-perftools-2.8/src/emergency_malloc.cc Examining data/google-perftools-2.8/src/emergency_malloc.h Examining data/google-perftools-2.8/src/emergency_malloc_for_stacktrace.cc Examining data/google-perftools-2.8/src/fake_stacktrace_scope.cc Examining data/google-perftools-2.8/src/getenv_safe.h Examining data/google-perftools-2.8/src/getpc.h Examining data/google-perftools-2.8/src/google/heap-checker.h Examining data/google-perftools-2.8/src/google/heap-profiler.h Examining data/google-perftools-2.8/src/google/malloc_extension.h Examining data/google-perftools-2.8/src/google/malloc_extension_c.h Examining data/google-perftools-2.8/src/google/malloc_hook.h Examining data/google-perftools-2.8/src/google/malloc_hook_c.h Examining data/google-perftools-2.8/src/google/profiler.h Examining data/google-perftools-2.8/src/google/stacktrace.h Examining data/google-perftools-2.8/src/google/tcmalloc.h Examining data/google-perftools-2.8/src/gperftools/heap-checker.h Examining data/google-perftools-2.8/src/gperftools/heap-profiler.h Examining data/google-perftools-2.8/src/gperftools/malloc_extension.h Examining data/google-perftools-2.8/src/gperftools/malloc_extension_c.h Examining data/google-perftools-2.8/src/gperftools/malloc_hook.h Examining data/google-perftools-2.8/src/gperftools/malloc_hook_c.h Examining data/google-perftools-2.8/src/gperftools/nallocx.h Examining data/google-perftools-2.8/src/gperftools/profiler.h Examining data/google-perftools-2.8/src/gperftools/stacktrace.h Examining data/google-perftools-2.8/src/heap-checker-bcad.cc Examining data/google-perftools-2.8/src/heap-checker.cc Examining data/google-perftools-2.8/src/heap-profile-stats.h Examining data/google-perftools-2.8/src/heap-profile-table.cc Examining data/google-perftools-2.8/src/heap-profile-table.h Examining data/google-perftools-2.8/src/heap-profiler.cc Examining data/google-perftools-2.8/src/internal_logging.cc Examining data/google-perftools-2.8/src/internal_logging.h Examining data/google-perftools-2.8/src/libc_override.h Examining data/google-perftools-2.8/src/libc_override_gcc_and_weak.h Examining data/google-perftools-2.8/src/libc_override_glibc.h Examining data/google-perftools-2.8/src/libc_override_osx.h Examining data/google-perftools-2.8/src/libc_override_redefine.h Examining data/google-perftools-2.8/src/linked_list.h Examining data/google-perftools-2.8/src/malloc_extension.cc Examining data/google-perftools-2.8/src/malloc_hook-inl.h Examining data/google-perftools-2.8/src/malloc_hook.cc Examining data/google-perftools-2.8/src/malloc_hook_mmap_freebsd.h Examining data/google-perftools-2.8/src/malloc_hook_mmap_linux.h Examining data/google-perftools-2.8/src/maybe_emergency_malloc.h Examining data/google-perftools-2.8/src/maybe_threads.cc Examining data/google-perftools-2.8/src/maybe_threads.h Examining data/google-perftools-2.8/src/memfs_malloc.cc Examining data/google-perftools-2.8/src/memory_region_map.cc Examining data/google-perftools-2.8/src/memory_region_map.h Examining data/google-perftools-2.8/src/packed-cache-inl.h Examining data/google-perftools-2.8/src/page_heap.cc Examining data/google-perftools-2.8/src/page_heap.h Examining data/google-perftools-2.8/src/page_heap_allocator.h Examining data/google-perftools-2.8/src/pagemap.h Examining data/google-perftools-2.8/src/profile-handler.cc Examining data/google-perftools-2.8/src/profile-handler.h Examining data/google-perftools-2.8/src/profiledata.cc Examining data/google-perftools-2.8/src/profiledata.h Examining data/google-perftools-2.8/src/profiler.cc Examining data/google-perftools-2.8/src/raw_printer.cc Examining data/google-perftools-2.8/src/raw_printer.h Examining data/google-perftools-2.8/src/sampler.cc Examining data/google-perftools-2.8/src/sampler.h Examining data/google-perftools-2.8/src/span.cc Examining data/google-perftools-2.8/src/span.h Examining data/google-perftools-2.8/src/stack_trace_table.cc Examining data/google-perftools-2.8/src/stack_trace_table.h Examining data/google-perftools-2.8/src/stacktrace.cc Examining data/google-perftools-2.8/src/stacktrace_arm-inl.h Examining data/google-perftools-2.8/src/stacktrace_generic-inl.h Examining data/google-perftools-2.8/src/stacktrace_impl_setup-inl.h Examining data/google-perftools-2.8/src/stacktrace_instrument-inl.h Examining data/google-perftools-2.8/src/stacktrace_libgcc-inl.h Examining data/google-perftools-2.8/src/stacktrace_libunwind-inl.h Examining data/google-perftools-2.8/src/stacktrace_powerpc-darwin-inl.h Examining data/google-perftools-2.8/src/stacktrace_powerpc-inl.h Examining data/google-perftools-2.8/src/stacktrace_powerpc-linux-inl.h Examining data/google-perftools-2.8/src/stacktrace_win32-inl.h Examining data/google-perftools-2.8/src/stacktrace_x86-inl.h Examining data/google-perftools-2.8/src/static_vars.cc Examining data/google-perftools-2.8/src/static_vars.h Examining data/google-perftools-2.8/src/symbolize.cc Examining data/google-perftools-2.8/src/symbolize.h Examining data/google-perftools-2.8/src/system-alloc.cc Examining data/google-perftools-2.8/src/system-alloc.h Examining data/google-perftools-2.8/src/tcmalloc.cc Examining data/google-perftools-2.8/src/tcmalloc.h Examining data/google-perftools-2.8/src/tcmalloc_guard.h Examining data/google-perftools-2.8/src/tests/addressmap_unittest.cc Examining data/google-perftools-2.8/src/tests/atomicops_unittest.cc Examining data/google-perftools-2.8/src/tests/current_allocated_bytes_test.cc Examining data/google-perftools-2.8/src/tests/debugallocation_test.cc Examining data/google-perftools-2.8/src/tests/frag_unittest.cc Examining data/google-perftools-2.8/src/tests/getpc_test.cc Examining data/google-perftools-2.8/src/tests/heap-checker_unittest.cc Examining data/google-perftools-2.8/src/tests/heap-profiler_unittest.cc Examining data/google-perftools-2.8/src/tests/large_heap_fragmentation_unittest.cc Examining data/google-perftools-2.8/src/tests/low_level_alloc_unittest.cc Examining data/google-perftools-2.8/src/tests/malloc_extension_c_test.c Examining data/google-perftools-2.8/src/tests/malloc_extension_test.cc Examining data/google-perftools-2.8/src/tests/malloc_hook_test.cc Examining data/google-perftools-2.8/src/tests/markidle_unittest.cc Examining data/google-perftools-2.8/src/tests/memalign_unittest.cc Examining data/google-perftools-2.8/src/tests/packed-cache_test.cc Examining data/google-perftools-2.8/src/tests/page_heap_test.cc Examining data/google-perftools-2.8/src/tests/pagemap_unittest.cc Examining data/google-perftools-2.8/src/tests/profile-handler_unittest.cc Examining data/google-perftools-2.8/src/tests/profiledata_unittest.cc Examining data/google-perftools-2.8/src/tests/profiler_unittest.cc Examining data/google-perftools-2.8/src/tests/raw_printer_test.cc Examining data/google-perftools-2.8/src/tests/realloc_unittest.cc Examining data/google-perftools-2.8/src/tests/sampler_test.cc Examining data/google-perftools-2.8/src/tests/sampling_test.cc Examining data/google-perftools-2.8/src/tests/simple_compat_test.cc Examining data/google-perftools-2.8/src/tests/stack_trace_table_test.cc Examining data/google-perftools-2.8/src/tests/stacktrace_unittest.cc Examining data/google-perftools-2.8/src/tests/system-alloc_unittest.cc Examining data/google-perftools-2.8/src/tests/tcmalloc_large_unittest.cc Examining data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc Examining data/google-perftools-2.8/src/tests/testutil.cc Examining data/google-perftools-2.8/src/tests/testutil.h Examining data/google-perftools-2.8/src/tests/thread_dealloc_unittest.cc Examining data/google-perftools-2.8/src/third_party/valgrind.h Examining data/google-perftools-2.8/src/thread_cache.cc Examining data/google-perftools-2.8/src/thread_cache.h Examining data/google-perftools-2.8/src/windows/addr2line-pdb.c Examining data/google-perftools-2.8/src/windows/auto_testing_hook.h Examining data/google-perftools-2.8/src/windows/config.h Examining data/google-perftools-2.8/src/windows/get_mangled_names.cc Examining data/google-perftools-2.8/src/windows/google/tcmalloc.h Examining data/google-perftools-2.8/src/windows/gperftools/tcmalloc.h Examining data/google-perftools-2.8/src/windows/ia32_modrm_map.cc Examining data/google-perftools-2.8/src/windows/ia32_opcode_map.cc Examining data/google-perftools-2.8/src/windows/mingw.h Examining data/google-perftools-2.8/src/windows/mini_disassembler.cc Examining data/google-perftools-2.8/src/windows/mini_disassembler.h Examining data/google-perftools-2.8/src/windows/mini_disassembler_types.h Examining data/google-perftools-2.8/src/windows/nm-pdb.c Examining data/google-perftools-2.8/src/windows/override_functions.cc Examining data/google-perftools-2.8/src/windows/patch_functions.cc Examining data/google-perftools-2.8/src/windows/port.cc Examining data/google-perftools-2.8/src/windows/port.h Examining data/google-perftools-2.8/src/windows/preamble_patcher.cc Examining data/google-perftools-2.8/src/windows/preamble_patcher.h Examining data/google-perftools-2.8/src/windows/preamble_patcher_test.cc Examining data/google-perftools-2.8/src/windows/preamble_patcher_with_stub.cc Examining data/google-perftools-2.8/src/windows/system-alloc.cc FINAL RESULTS: data/google-perftools-2.8/src/base/sysinfo.cc:738:19: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ssize_t len = readlink(object_path.buf_, current_filename_, PATH_MAX); data/google-perftools-2.8/src/base/linuxthreads.cc:298:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(marker_name, proc_self_task); data/google-perftools-2.8/src/base/linuxthreads.cc:414:15: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcat(strcpy(fname, "/proc/"), data/google-perftools-2.8/src/base/linuxthreads.cc:414:22: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcat(strcpy(fname, "/proc/"), data/google-perftools-2.8/src/base/logging.h:70:30: [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 perftools_vsnprintf vsnprintf data/google-perftools-2.8/src/base/sysinfo.cc:279:12: [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. CHECK_LT(snprintf(buf, buf_size, data/google-perftools-2.8/src/heap-profile-table.cc:301:15: [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. printed = snprintf(buf + buflen, bufsize - buflen, " 0x%08" PRIxPTR, data/google-perftools-2.8/src/heap-profiler.cc:279: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(buf, sizeof(buf), ("%" PRId64 " MB allocated cumulatively, " data/google-perftools-2.8/src/heap-profiler.cc:286: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(buf, sizeof(buf), ("%" PRId64 " MB freed cumulatively, " data/google-perftools-2.8/src/heap-profiler.cc:603:9: [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(buf, sizeof(buf), ("Exiting, %" PRId64 " MB in use"), data/google-perftools-2.8/src/heap-profiler.cc:606:9: [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(buf, sizeof(buf), ("Exiting, %" PRId64 " kB in use"), data/google-perftools-2.8/src/heap-profiler.cc:609:9: [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(buf, sizeof(buf), ("Exiting, %" PRId64 " bytes in use"), data/google-perftools-2.8/src/heap-profiler.cc:613: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(buf, sizeof(buf), ("Exiting")); data/google-perftools-2.8/src/internal_logging.cc:175:24: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. void TCMalloc_Printer::printf(const char* format, ...) { data/google-perftools-2.8/src/internal_logging.h:137:8: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. void printf(const char* format, ...) data/google-perftools-2.8/src/symbolize.cc:149:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(get_pprof_path(), R_OK) != 0) { data/google-perftools-2.8/src/symbolize.cc:211:7: [4] (shell) execlp: 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. execlp(get_pprof_path(), get_pprof_path(), data/google-perftools-2.8/src/symbolize.cc:247:20: [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. written += snprintf(pprof_buffer + written, kOutBufSize - written, data/google-perftools-2.8/src/tests/frag_unittest.cc:105:42: [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 No way to calculate time on your system data/google-perftools-2.8/src/tests/frag_unittest.cc:125:42: [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 No way to calculate time on your system data/google-perftools-2.8/src/tests/heap-profiler_unittest.cc:159:16: [4] (shell) execl: 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. return execl(argv[0], argv[0], NULL); // run child with no args data/google-perftools-2.8/src/tests/profiler_unittest.cc:90: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(stderr, (" If you don't specify, set CPUPROFILE " data/google-perftools-2.8/src/tests/profiler_unittest.cc:130:18: [4] (shell) execl: 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. return execl(argv[0], argv[0], argv[1], NULL); data/google-perftools-2.8/src/windows/addr2line-pdb.c:116:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(search, ";" WEBSYM); data/google-perftools-2.8/src/windows/addr2line-pdb.c:121:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(search, WEBSYM); /* Use a default value */ data/google-perftools-2.8/src/windows/nm-pdb.c:132:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("No symbols available for the module.\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:135:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: Exports\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:138:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: COFF\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:141:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: CodeView\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:144:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: SYM\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:147:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: Virtual\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:150:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: PDB\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:153:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: DIA\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:156:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: Deferred\n")); /* not actually loaded */ data/google-perftools-2.8/src/windows/nm-pdb.c:159:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Loaded symbols: Unknown format.\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:171:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(("Warning: Unmatched symbols.\n")); data/google-perftools-2.8/src/windows/nm-pdb.c:230:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(search, ";" WEBSYM); data/google-perftools-2.8/src/windows/nm-pdb.c:235:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(search, WEBSYM); /* Use a default value */ data/google-perftools-2.8/src/windows/port.h:106:72: [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 set up type aliases. Edit port.h for your system. data/google-perftools-2.8/src/windows/port.h:333:12: [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. inline int snprintf(char *str, size_t size, const char *format, ...) { data/google-perftools-2.8/src/windows/port.h:372:12: [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. inline int access(const char *pathname, int mode) { data/google-perftools-2.8/src/windows/port.h:397:14: [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. inline FILE *popen(const char *command, const char *type) { data/google-perftools-2.8/src/base/commandlineflags.h:161: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-perftools-2.8/src/base/commandlineflags.h:161: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-perftools-2.8/src/base/commandlineflags.h:164:44: [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. tcmalloc::commandlineflags::StringToBool(getenv(envname), dflt) data/google-perftools-2.8/src/base/commandlineflags.h:167:43: [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. tcmalloc::commandlineflags::StringToInt(getenv(envname), dflt) data/google-perftools-2.8/src/base/commandlineflags.h:170:48: [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. tcmalloc::commandlineflags::StringToLongLong(getenv(envname), dflt) data/google-perftools-2.8/src/base/commandlineflags.h:173:46: [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. tcmalloc::commandlineflags::StringToDouble(getenv(envname), dflt) data/google-perftools-2.8/src/base/dynamic_annotations.c:175: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. char *env = getenv("VALGRIND_SLOWDOWN"); data/google-perftools-2.8/src/base/low_level_alloc.cc:127:62: [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. static int LLA_SkiplistLevels(size_t size, size_t base, bool random) { data/google-perftools-2.8/src/base/low_level_alloc.cc:132:38: [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. int level = IntLog2(size, base) + (random? Random() : 1); data/google-perftools-2.8/src/base/simple_mutex.h:220:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&mutex_); data/google-perftools-2.8/src/base/simple_mutex.h:224:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&mutex_); data/google-perftools-2.8/src/base/simple_mutex.h:228: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-perftools-2.8/src/base/sysinfo.cc:185:14: [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/google-perftools-2.8/src/base/sysinfo.cc:232:18: [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* envval = getenv(env_name); data/google-perftools-2.8/src/debugallocation.cc:966: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. const char *val = getenv("TCMALLOC_TRACE_FILE"); data/google-perftools-2.8/src/heap-profiler.cc:576:29: [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 *signal_number_str = getenv("HEAPPROFILESIGNAL"); data/google-perftools-2.8/src/profile-handler.cc:328:18: [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. timer_type_ = (getenv("CPUPROFILE_REALTIME") ? ITIMER_REAL : ITIMER_PROF); data/google-perftools-2.8/src/profile-handler.cc:333:20: [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* fr = getenv("CPUPROFILE_FREQUENCY"); data/google-perftools-2.8/src/profile-handler.cc:349: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 *per_thread = getenv("CPUPROFILE_PER_THREAD_TIMERS"); data/google-perftools-2.8/src/profile-handler.cc:350:31: [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 *signal_number = getenv("CPUPROFILE_TIMER_SIGNAL"); data/google-perftools-2.8/src/profiler.cc:185: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("CPUPROFILE") == NULL) { data/google-perftools-2.8/src/profiler.cc:202:29: [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 *signal_number_str = getenv("CPUPROFILESIGNAL"); data/google-perftools-2.8/src/tcmalloc.cc:1144:13: [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("MALLOCSTATS"); data/google-perftools-2.8/src/tests/getpc_test.cc:85:3: [3] (random) srand: 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. srand(r); data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:892:15: [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. s1.insert(random()); data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:896:9: [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. if (random() % 51 == 0) { data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:898: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. if (random() % 2 == 0) { data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:930: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. poll(NULL, 0, random() % 100); data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:933:9: [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. if (random() % 3 == 0) { data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1024: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. size = 3 + random() % 30; data/google-perftools-2.8/src/tests/heap-profiler_unittest.cc:89:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpdir = getenv("TMPDIR"); data/google-perftools-2.8/src/tests/heap-profiler_unittest.cc:108:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpdir = getenv("TMPDIR"); data/google-perftools-2.8/src/tests/pagemap_unittest.cc:100:5: [3] (random) srand: 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. srand(301); // srand isn't great, but it's portable data/google-perftools-2.8/src/tests/profile-handler_unittest.cc:145:20: [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. timer_type_ = (getenv("CPUPROFILE_REALTIME") ? ITIMER_REAL : ITIMER_PROF); data/google-perftools-2.8/src/tests/profile-handler_unittest.cc:148:38: [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. linux_per_thread_timers_mode_ = (getenv("CPUPROFILE_PER_THREAD_TIMERS") != NULL); data/google-perftools-2.8/src/tests/profile-handler_unittest.cc:149:33: [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 *signal_number = getenv("CPUPROFILE_TIMER_SIGNAL"); data/google-perftools-2.8/src/tests/profiledata_unittest.cc:120:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpdir = getenv("TMPDIR"); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:266:5: [3] (random) srandom: 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. srandom(seed); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:289:14: [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. return random() * 0; data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:291:14: [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. return random() % n; data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:298:22: [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. const int base = random() % (max_log+1); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:299:12: [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. return random() % (1 << base); data/google-perftools-2.8/src/windows/port.h:236:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&mutex_); data/google-perftools-2.8/src/windows/port.h:250:28: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. void InitializeMutex() { InitializeCriticalSection(&mutex_); } data/google-perftools-2.8/src/windows/port.h:430:13: [3] (random) srandom: 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 srandom(unsigned int seed) { srand(seed); } data/google-perftools-2.8/src/windows/port.h:430:42: [3] (random) srand: 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 srandom(unsigned int seed) { srand(seed); } data/google-perftools-2.8/src/windows/port.h:431:13: [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 long random(void) { return rand(); } data/google-perftools-2.8/benchmark/binary_trees.cc:90:33: [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). int given_depth = argc >= 2 ? atoi(argv[1]) : 20; data/google-perftools-2.8/benchmark/binary_trees.cc:91:46: [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). int thread_count = std::max(1, argc >= 3 ? atoi(argv[2]) : 1) - 1; data/google-perftools-2.8/src/base/atomicops-internals-x86.cc:83: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 vendor[13]; data/google-perftools-2.8/src/base/atomicops-internals-x86.cc:84: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(vendor, &ebx, 4); data/google-perftools-2.8/src/base/atomicops-internals-x86.cc:85: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(vendor + 4, &edx, 4); data/google-perftools-2.8/src/base/atomicops-internals-x86.cc:86: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(vendor + 8, &ecx, 4); data/google-perftools-2.8/src/base/basictypes.h:247: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(dest, source, sizeof(Dest)); data/google-perftools-2.8/src/base/elfcore.h:337:22: [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((r).uregs, (f).mips_regs.uregs, \ data/google-perftools-2.8/src/base/linux_syscall_support.h:209: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 d_name[256]; data/google-perftools-2.8/src/base/linux_syscall_support.h:217: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 d_name[256]; data/google-perftools-2.8/src/base/linux_syscall_support.h:362:12: [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. unsigned char __pad0[4]; data/google-perftools-2.8/src/base/linux_syscall_support.h:369:12: [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. unsigned char __pad3[4]; data/google-perftools-2.8/src/base/linux_syscall_support.h:2617:29: [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). LSS_INLINE int LSS_NAME(open)(const char* p, int f, int m) { data/google-perftools-2.8/src/base/linux_syscall_support.h:2621:33: [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). LSS_INLINE _syscall3(int, open, const char*, p, data/google-perftools-2.8/src/base/linux_syscall_support.h:2742:13: [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(oldact, act, sizeof(*act)); data/google-perftools-2.8/src/base/linux_syscall_support.h:2748:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&oldact->sa_mask, &ptr_oa->sa_mask, sizeof(ptr_oa->sa_mask)); data/google-perftools-2.8/src/base/linuxthreads.cc:238: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[amount]; data/google-perftools-2.8/src/base/linuxthreads.cc:261: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 proc_self_task[80], marker_name[48], *marker_path; data/google-perftools-2.8/src/base/linuxthreads.cc:262:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *proc_paths[3]; data/google-perftools-2.8/src/base/linuxthreads.cc:297:22: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. local_itoa(strrchr(strcpy(proc_self_task, "/proc/"), '\000'), ppid); data/google-perftools-2.8/src/base/linuxthreads.cc:300:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(proc_self_task, "/task/"); data/google-perftools-2.8/src/base/linuxthreads.cc:306:14: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. local_itoa(strcpy(marker_path, "/fd/") + 4, marker); data/google-perftools-2.8/src/base/linuxthreads.cc:374:9: [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-perftools-2.8/src/base/linuxthreads.cc:413:15: [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[entry->d_reclen + 48]; data/google-perftools-2.8/src/base/linuxthreads.cc:414:29: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcat(strcat(strcpy(fname, "/proc/"), data/google-perftools-2.8/src/base/linuxthreads.cc:553: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_mem[ALT_STACKSIZE]; data/google-perftools-2.8/src/base/logging.cc:91:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0664); data/google-perftools-2.8/src/base/logging.h:201: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[600]; data/google-perftools-2.8/src/base/low_level_alloc.cc:545: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 chars[sizeof(DefaultPagesAllocator)]; data/google-perftools-2.8/src/base/sysinfo.cc:94:36: [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 safeopen(filename, mode) open(filename, mode) data/google-perftools-2.8/src/base/sysinfo.cc:169:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char envvar_buf[1024]; // enough to hold any envvar we care about data/google-perftools-2.8/src/base/sysinfo.cc:176: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 envbuf[16<<10]; data/google-perftools-2.8/src/base/sysinfo.cc:298: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 kDefaultPerms[5] = "r-xp"; data/google-perftools-2.8/src/base/sysinfo.cc:512:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). NO_INTR(fd_ = open(ibuf_, O_RDONLY)); data/google-perftools-2.8/src/base/sysinfo.cc:520:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). NO_INTR(fd_ = open(ibuf_, O_RDONLY)); data/google-perftools-2.8/src/base/sysinfo.cc:527:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). NO_INTR(fd_ = open(ibuf_, O_RDONLY)); data/google-perftools-2.8/src/base/sysinfo.cc:635: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 tmpflags[5]; data/google-perftools-2.8/src/base/sysinfo.cc:638:5: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(flags_, "r-xp"); data/google-perftools-2.8/src/base/sysinfo.cc:713: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 kPerms[8][4] = { "---", "--x", "-w-", "-wx", data/google-perftools-2.8/src/base/sysinfo.cc:793: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 kDefaultPerms[5] = "r-xp"; data/google-perftools-2.8/src/base/sysinfo.h:108: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 buf_[kBufSize]; data/google-perftools-2.8/src/base/sysinfo.h:213: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 current_filename_[PATH_MAX]; data/google-perftools-2.8/src/base/sysinfo.h:218: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 flags_[10]; data/google-perftools-2.8/src/base/vdso_support.cc:84: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("/proc/self/auxv", O_RDONLY); data/google-perftools-2.8/src/central_freelist.h:198: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 pad_[64 - kFreeListSizeMod64]; data/google-perftools-2.8/src/common.h:186:12: [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. unsigned char class_array_[kClassArraySize]; data/google-perftools-2.8/src/debugallocation.cc:280:19: [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 unsigned char kMagicDeletedBuffer[1024]; data/google-perftools-2.8/src/debugallocation.cc:698:32: [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. union { void* alignment; char buf[sizeof(SymbolTable)]; } tablebuf; data/google-perftools-2.8/src/debugallocation.cc:885: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[64]; data/google-perftools-2.8/src/debugallocation.cc:890: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 numbuf[25]; data/google-perftools-2.8/src/debugallocation.cc:972:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). trace_fd = open(val, O_CREAT|O_TRUNC|O_WRONLY, 0666); data/google-perftools-2.8/src/debugallocation.cc:1149: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 chars[sizeof(DebugMallocImplementation)]; data/google-perftools-2.8/src/debugallocation.cc:1311: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(p->data_addr(), ptr, (old_size < size) ? old_size : size); data/google-perftools-2.8/src/emergency_malloc.cc: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 bytes[sizeof(EmergencyArenaPagesAllocator)]; data/google-perftools-2.8/src/emergency_malloc.cc:153: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(new_ptr, old_ptr, copy_size); data/google-perftools-2.8/src/getpc.h:101:12: [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. unsigned char ins[16]; data/google-perftools-2.8/src/gperftools/profiler.h:160: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 profile_name[1024]; /* Name of profile file being written, or '\0' */ data/google-perftools-2.8/src/heap-checker.cc:113: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]; // TracerPid comes relatively earlier in status output data/google-perftools-2.8/src/heap-checker.cc:114: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("/proc/self/status", O_RDONLY); data/google-perftools-2.8/src/heap-checker.cc:1592: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(n, name, strlen(name) + 1); data/google-perftools-2.8/src/heap-checker.cc:2068: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 pid_buf[15]; data/google-perftools-2.8/src/heap-checker.cc:2275: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). if (verbose_str && atoi(verbose_str)) { // different than the default of 0? data/google-perftools-2.8/src/heap-checker.cc:2276:21: [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). FLAGS_verbose = atoi(verbose_str); data/google-perftools-2.8/src/heap-profile-table.cc:418: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-perftools-2.8/src/heap-profile-table.cc:448:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[512]; data/google-perftools-2.8/src/heap-profile-table.cc:589: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/google-perftools-2.8/src/heap-profiler.cc:232: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 file_name[1000]; data/google-perftools-2.8/src/heap-profiler.cc:274: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 buf[128]; data/google-perftools-2.8/src/heap-profiler.cc:485: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(filename_prefix, prefix, prefix_length); data/google-perftools-2.8/src/heap-profiler.cc:563: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[PATH_MAX]; data/google-perftools-2.8/src/heap-profiler.cc:597: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 buf[128]; data/google-perftools-2.8/src/internal_logging.cc:53: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 stats_buffer[kStatsBufferSize] = { 0 }; data/google-perftools-2.8/src/internal_logging.cc:73: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_[kBufSize]; data/google-perftools-2.8/src/internal_logging.cc:154: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(p_, str, n); data/google-perftools-2.8/src/internal_logging.cc:162: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[22]; // more than enough for 2^64 in smallest supported base (10) data/google-perftools-2.8/src/malloc_extension.cc:259: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-perftools-2.8/src/malloc_extension.cc:291: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 buf[32]; data/google-perftools-2.8/src/malloc_extension.cc:313: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 label[32]; data/google-perftools-2.8/src/malloc_extension.cc:314: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(label, "heap_v2/%d", sample_period); data/google-perftools-2.8/src/maybe_threads.cc:93: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(&output, &input, s); data/google-perftools-2.8/src/memfs_malloc.cc:119: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(HugetlbSysAllocator)]; data/google-perftools-2.8/src/memfs_malloc.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 path[PATH_MAX]; data/google-perftools-2.8/src/memfs_malloc.cc:235: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(path, FLAGS_memfs_malloc_path.data(), pathlen); data/google-perftools-2.8/src/memfs_malloc.cc:236: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(path + pathlen, ".XXXXXX", 8); // Also copies terminating \0 data/google-perftools-2.8/src/memfs_malloc.cc:238:20: [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). int hugetlb_fd = mkstemp(path); data/google-perftools-2.8/src/memory_region_map.cc:180: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 rep[sizeof(RegionSet)]; data/google-perftools-2.8/src/profiledata.cc:76: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(&evict_[num_evicted_], entry.stack, d * sizeof(Slot)); data/google-perftools-2.8/src/profiledata.cc:99: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(fname, O_CREAT | O_WRONLY | O_TRUNC, 0666); data/google-perftools-2.8/src/profiledata.h:84: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 profile_name[1024]; // Name of file being written, or '\0' data/google-perftools-2.8/src/profiler.cc:148: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 base_profile_name[PATH_MAX]; data/google-perftools-2.8/src/profiler.cc:159: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 full_profile_name[PATH_MAX + 16]; data/google-perftools-2.8/src/profiler.cc:216: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 fname[PATH_MAX]; data/google-perftools-2.8/src/span.h:81: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 span_iter_space[sizeof(SpanSet::iterator)]; data/google-perftools-2.8/src/stacktrace_powerpc-linux-inl.h:185:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dummy[128]; data/google-perftools-2.8/src/stacktrace_powerpc-linux-inl.h:194:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dummy[64]; data/google-perftools-2.8/src/stacktrace_powerpc-linux-inl.h:202:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dummy[64 + 16]; data/google-perftools-2.8/src/static_vars.h:118: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 memory[sizeof(PageHeap)]; data/google-perftools-2.8/src/symbolize.cc:95: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 program_invocation_name[PATH_MAX]; data/google-perftools-2.8/src/symbolize.cc:103: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 program_invocation_name[PATH_MAX]; data/google-perftools-2.8/src/system-alloc.cc:152: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(SbrkSysAllocator)]; data/google-perftools-2.8/src/system-alloc.cc:163: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(MmapSysAllocator)]; data/google-perftools-2.8/src/system-alloc.cc:200: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(DefaultSysAllocator)]; data/google-perftools-2.8/src/system-alloc.cc:367: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). physmem_fd = open("/dev/mem", O_RDWR); data/google-perftools-2.8/src/tcmalloc.cc:1147:19: [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). int level = atoi(env); data/google-perftools-2.8/src/tcmalloc.cc:1301: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[N]; data/google-perftools-2.8/src/tcmalloc.cc:1574: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(new_ptr, old_ptr, ((old_size < new_size) ? old_size : new_size)); data/google-perftools-2.8/src/tests/debugallocation_test.cc:305: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 stuff[50]; data/google-perftools-2.8/src/tests/debugallocation_test.cc:330:19: [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). test_to_run = atoi(argv[1]); data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1112: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 b[7]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1120: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 b2[11]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1126: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 d1[15]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1131: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 d2[19]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1136: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 d[3]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1182: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 d1[11]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1191: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 d2[15]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1229: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 n1[5]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1231: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 n2[11]; data/google-perftools-2.8/src/tests/heap-checker_unittest.cc:1233: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 n3[27]; data/google-perftools-2.8/src/tests/heap-profiler_unittest.cc:132:17: [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). num_forks = atoi(argv[1]); data/google-perftools-2.8/src/tests/malloc_extension_c_test.c:136:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[200]; data/google-perftools-2.8/src/tests/malloc_hook_test.cc:212: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[64]; data/google-perftools-2.8/src/tests/profiledata_unittest.cc:166: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). FileDescriptor fd(open(filename_.c_str(), O_RDONLY)); data/google-perftools-2.8/src/tests/profiledata_unittest.cc:189: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). FileDescriptor fd(open(filename_.c_str(), O_RDONLY)); data/google-perftools-2.8/src/tests/profiler_unittest.cc:59: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 b[128]; data/google-perftools-2.8/src/tests/profiler_unittest.cc:72: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 b[128]; data/google-perftools-2.8/src/tests/profiler_unittest.cc:95:13: [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). g_iters = atoi(argv[1]); data/google-perftools-2.8/src/tests/profiler_unittest.cc:99:19: [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). num_threads = atoi(argv[2]); data/google-perftools-2.8/src/tests/raw_printer_test.cc:19: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[1]; data/google-perftools-2.8/src/tests/raw_printer_test.cc:31: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[100]; data/google-perftools-2.8/src/tests/raw_printer_test.cc:40:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[3]; data/google-perftools-2.8/src/tests/raw_printer_test.cc:49: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[12]; data/google-perftools-2.8/src/tests/sampler_test.cc:88: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]; // should be big enough for all logging data/google-perftools-2.8/src/tests/sampling_test.cc:60: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(), "w"); data/google-perftools-2.8/src/tests/system-alloc_unittest.cc:97: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 array_[kArraySize]; data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:160:12: [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. unsigned char data[OVERALIGNMENT * 2]; // make the object size different from data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:196: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(OOMAbleSysAlloc)]; data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:1202:33: [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). AllocatorState rnd(argc > 1 ? atoi(argv[1]) : 100); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:1487: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("/dev/zero", O_RDONLY); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:1640: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 mmp[64]; data/google-perftools-2.8/src/windows/addr2line-pdb.c:71: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]; /* Enough to hold one hex address, I trust! */ data/google-perftools-2.8/src/windows/patch_functions.cc:184: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(this->windows_fn_, that.windows_fn_, sizeof(windows_fn_)); data/google-perftools-2.8/src/windows/port.h:375: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). inline int open(const char *pathname, int flags, int mode = 0) { data/google-perftools-2.8/src/windows/preamble_patcher.cc:96: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(reinterpret_cast<void*>(&relative_offset), data/google-perftools-2.8/src/windows/preamble_patcher.cc:102: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(reinterpret_cast<void*>(&relative_offset), data/google-perftools-2.8/src/windows/preamble_patcher.cc:115:9: [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(reinterpret_cast<void*>(&target_offset), data/google-perftools-2.8/src/windows/preamble_patcher.cc:120:9: [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(&new_target_v, reinterpret_cast<void*>(target + 2), 4); data/google-perftools-2.8/src/windows/preamble_patcher.cc:390:9: [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(reinterpret_cast<void*>(target + target_bytes), data/google-perftools-2.8/src/windows/preamble_patcher.cc:616: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(reinterpret_cast<void*>(target), data/google-perftools-2.8/src/windows/preamble_patcher.cc:618: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(reinterpret_cast<void*>(target + 2), data/google-perftools-2.8/src/windows/preamble_patcher.cc:648: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(reinterpret_cast<void*>(target + 1), data/google-perftools-2.8/src/windows/preamble_patcher.cc:683:9: [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(reinterpret_cast<void*>(target), data/google-perftools-2.8/src/windows/preamble_patcher.cc:694: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(reinterpret_cast<void*>(target), data/google-perftools-2.8/src/windows/preamble_patcher.cc:697: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(reinterpret_cast<void*>(target + jmp_offset_in_instruction), data/google-perftools-2.8/src/windows/preamble_patcher.cc:726: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(reinterpret_cast<void*>(target), data/google-perftools-2.8/src/windows/preamble_patcher.cc:729: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(reinterpret_cast<void*>(target + mov_offset_in_instruction), data/google-perftools-2.8/src/windows/preamble_patcher_with_stub.cc:189:9: [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(reinterpret_cast<void*>(preamble_stub + stub_bytes), data/google-perftools-2.8/src/windows/preamble_patcher_with_stub.cc:232: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(reinterpret_cast<void*>(preamble_stub + stub_bytes + 1), data/google-perftools-2.8/src/windows/preamble_patcher_with_stub.cc:241: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(reinterpret_cast<void*>(preamble_stub + trampoline_pos + 3), data/google-perftools-2.8/src/windows/preamble_patcher_with_stub.cc:272: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(reinterpret_cast<void*>(target + 1), data/google-perftools-2.8/src/windows/system-alloc.cc:59: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 virtual_space[sizeof(VirtualSysAllocator)]; data/google-perftools-2.8/benchmark/run_benchmark.c:102:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (param && name[strlen(name)-1] != ')') { data/google-perftools-2.8/src/base/linux_syscall_support.h:2529:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). LSS_INLINE _syscall3(ssize_t, read, int, f, data/google-perftools-2.8/src/base/linuxthreads.cc:299: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). marker_path = marker_name + strlen(marker_name); data/google-perftools-2.8/src/base/logging.h:120:41: [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). WRITE_TO_STDERR(strerror(err_no), strlen(strerror(err_no))); \ data/google-perftools-2.8/src/base/logging.h:203: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). if (buf[0] != '\0' && buf[strlen(buf)-1] != '\n') { data/google-perftools-2.8/src/base/logging.h:204: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). assert(strlen(buf)+1 < sizeof(buf)); data/google-perftools-2.8/src/base/logging.h:205:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf, "\n"); data/google-perftools-2.8/src/base/logging.h:207:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). WRITE_TO_STDERR(buf, strlen(buf)); data/google-perftools-2.8/src/base/sysinfo.cc:99:38: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define saferead(fd, buffer, size) read(fd, buffer, size) data/google-perftools-2.8/src/base/sysinfo.cc:407:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out, text, out_len); data/google-perftools-2.8/src/base/sysinfo.cc:596:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). NO_INTR(nread = read(fd_, etext_, ebuf_ - etext_)); data/google-perftools-2.8/src/base/sysinfo.cc:639:9: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf(stext_, "%llx-%llx %4s %llx %x:%x %lld %n", data/google-perftools-2.8/src/base/sysinfo.cc:658:9: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf(stext_, "0x%" SCNx64 " 0x%" SCNx64 " %*d %*d %*p %3s %*d %*d 0x%*x %*s %*s %*s %n", data/google-perftools-2.8/src/base/sysinfo.cc:670: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). size_t stext_length = strlen(stext_); data/google-perftools-2.8/src/base/sysinfo.cc:682:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(stext_+filename_offset); data/google-perftools-2.8/src/base/sysinfo.cc:720:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). NO_INTR(nread = read(fd_, ibuf_, sizeof(prmap_t))); data/google-perftools-2.8/src/base/vdso_support.cc:91:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(fd, &aux, sizeof(aux)) == sizeof(aux)) { data/google-perftools-2.8/src/heap-checker.cc:118:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int len = read(fd, buf, sizeof(buf)); data/google-perftools-2.8/src/heap-checker.cc:125:25: [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). rc = (strncmp(p + strlen(kTracerPid), "0\n", 2) != 0); data/google-perftools-2.8/src/heap-checker.cc:554: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(s2); data/google-perftools-2.8/src/heap-checker.cc:822:15: [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 sz = strlen(library_base); data/google-perftools-2.8/src/heap-checker.cc:1567: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 int len = profile_name_prefix->size() + strlen(name_) + 5 + data/google-perftools-2.8/src/heap-checker.cc:1568: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). strlen(HeapProfileTable::kFileExt) + 1; data/google-perftools-2.8/src/heap-checker.cc:1584: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). char* n = new char[strlen(name) + 1]; // do this before we lock data/google-perftools-2.8/src/heap-checker.cc:1592:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memcpy(n, name, strlen(name) + 1); data/google-perftools-2.8/src/heap-profile-table.cc:73: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. using std::equal; data/google-perftools-2.8/src/heap-profile-table.cc:184:9: [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. equal(key, key + depth, b->stack)) { data/google-perftools-2.8/src/heap-profile-table.cc:447: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). RawWrite(fd, kProfileHeader, strlen(kProfileHeader)); data/google-perftools-2.8/src/heap-profile-table.cc:453: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). RawWrite(fd, kProcSelfMapsHeader, strlen(kProcSelfMapsHeader)); data/google-perftools-2.8/src/heap-profile-table.cc:467: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 int prefix_length = strlen(prefix); data/google-perftools-2.8/src/heap-profile-table.cc:470: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). if ((strlen(fname) >= prefix_length) && data/google-perftools-2.8/src/heap-profiler.cc:205: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). RAW_DCHECK(bytes_written == strlen(buf), ""); data/google-perftools-2.8/src/heap-profiler.cc:257:25: [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). RawWrite(fd, profile, strlen(profile)); data/google-perftools-2.8/src/heap-profiler.cc:355:42: [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). RAW_LOG(INFO, "%.*s", static_cast<int>(strlen(message) - 1), message); data/google-perftools-2.8/src/heap-profiler.cc:483: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 int prefix_length = strlen(prefix); data/google-perftools-2.8/src/internal_logging.cc:81: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). state.AddStr(filename, strlen(filename)) data/google-perftools-2.8/src/internal_logging.cc:115:41: [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). (*log_message_writer)(stats_buffer, strlen(stats_buffer)); data/google-perftools-2.8/src/internal_logging.cc:130: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). return AddStr(item.u_.str, strlen(item.u_.str)); data/google-perftools-2.8/src/libc_override_gcc_and_weak.h:216:9: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* memalign(size_t align, size_t s) __THROW ALIAS(tc_memalign); data/google-perftools-2.8/src/libc_override_redefine.h:111:9: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* memalign(size_t a, size_t s) { return tc_memalign(a, s); } data/google-perftools-2.8/src/malloc_extension.cc:266:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). writer->append(buf, strlen(buf)); data/google-perftools-2.8/src/malloc_extension.cc:280: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). writer->append(kTitle, strlen(kTitle)); data/google-perftools-2.8/src/malloc_extension.cc:283:25: [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). writer->append(label, strlen(label)); data/google-perftools-2.8/src/malloc_extension.cc:293:25: [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). writer->append(buf, strlen(buf)); data/google-perftools-2.8/src/malloc_extension.cc:309: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). writer->append(kErrorMsg, strlen(kErrorMsg)); data/google-perftools-2.8/src/malloc_extension.cc:332: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). writer->append(kErrorMsg, strlen(kErrorMsg)); data/google-perftools-2.8/src/memory_region_map.cc:399:14: [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. std::equal(key, key + depth, bucket->stack)) { data/google-perftools-2.8/src/memory_region_map.cc:515:16: [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. std::equal(bucket.stack, bucket.stack + bucket.depth, curr->stack)) { data/google-perftools-2.8/src/profiledata.cc:228:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->profile_name, fname_, buf_size); data/google-perftools-2.8/src/profiler.cc:314:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->profile_name, collector_state.profile_name, buf_size); data/google-perftools-2.8/src/symbolize.cc:251: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). write(child_in[1], pprof_buffer, strlen(pprof_buffer)); data/google-perftools-2.8/src/symbolize.cc:261:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int bytes_read = read(child_out[1], symbol_buffer_ + total_bytes_read, data/google-perftools-2.8/src/tcmalloc.cc:544: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). write(STDERR_FILENO, buffer, strlen(buffer)); data/google-perftools-2.8/src/tcmalloc.cc:662: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). writer->append(kWarningMsg, strlen(kWarningMsg)); data/google-perftools-2.8/src/tcmalloc.cc:1310: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). write(STDERR_FILENO, buffer, strlen(buffer)); data/google-perftools-2.8/src/tcmalloc.h:63:18: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. extern "C" void* memalign(size_t __alignment, size_t __size) __THROW; data/google-perftools-2.8/src/tests/memalign_unittest.cc:137:19: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* ptr = memalign(a, s); data/google-perftools-2.8/src/tests/memalign_unittest.cc:155:16: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* p1 = memalign(1<<20, 1<<19); data/google-perftools-2.8/src/tests/memalign_unittest.cc:156:16: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* p2 = memalign(1<<19, 1<<19); data/google-perftools-2.8/src/tests/memalign_unittest.cc:157:16: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void* p3 = memalign(1<<21, 1<<19); data/google-perftools-2.8/src/tests/profiledata_unittest.cc:81:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). NO_INTR(len = read(fd, buf0 + num_bytes, count - num_bytes)); data/google-perftools-2.8/src/tests/tcmalloc_unittest.cc:139:16: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. return noopt(memalign(align, noopt(size))); data/google-perftools-2.8/src/windows/addr2line-pdb.c:111: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(search) + sizeof(";" WEBSYM) > SEARCH_CAP) { data/google-perftools-2.8/src/windows/nm-pdb.c:225: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(search) + sizeof(";" WEBSYM) > SEARCH_CAP) { data/google-perftools-2.8/src/windows/port.cc:237: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 int prefix_length = strlen(prefix); data/google-perftools-2.8/src/windows/port.cc:240: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). if ((strlen(fname) >= prefix_length) && data/google-perftools-2.8/src/windows/port.h:381:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inline ssize_t read(int fd, void *buf, size_t count) { ANALYSIS SUMMARY: Hits = 316 Lines analyzed = 61180 in approximately 1.63 seconds (37569 lines/second) Physical Source Lines of Code (SLOC) = 37403 Hits@level = [0] 179 [1] 67 [2] 160 [3] 47 [4] 41 [5] 1 Hits@level+ = [0+] 495 [1+] 316 [2+] 249 [3+] 89 [4+] 42 [5+] 1 Hits/KSLOC@level+ = [0+] 13.2342 [1+] 8.44852 [2+] 6.65722 [3+] 2.37949 [4+] 1.1229 [5+] 0.0267358 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.