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/libgc-8.0.4/darwin_stop_world.c Examining data/libgc-8.0.4/gcj_mlc.c Examining data/libgc-8.0.4/gc_dlopen.c Examining data/libgc-8.0.4/specific.c Examining data/libgc-8.0.4/new_hblk.c Examining data/libgc-8.0.4/reclaim.c Examining data/libgc-8.0.4/include/gc_gcj.h Examining data/libgc-8.0.4/include/gc_disclaim.h Examining data/libgc-8.0.4/include/private/pthread_stop_world.h Examining data/libgc-8.0.4/include/private/darwin_semaphore.h Examining data/libgc-8.0.4/include/private/gc_hdrs.h Examining data/libgc-8.0.4/include/private/thread_local_alloc.h Examining data/libgc-8.0.4/include/private/msvc_dbg.h Examining data/libgc-8.0.4/include/private/gc_priv.h Examining data/libgc-8.0.4/include/private/gc_locks.h Examining data/libgc-8.0.4/include/private/darwin_stop_world.h Examining data/libgc-8.0.4/include/private/gc_atomic_ops.h Examining data/libgc-8.0.4/include/private/gc_pmark.h Examining data/libgc-8.0.4/include/private/gcconfig.h Examining data/libgc-8.0.4/include/private/pthread_support.h Examining data/libgc-8.0.4/include/private/specific.h Examining data/libgc-8.0.4/include/private/dbg_mlc.h Examining data/libgc-8.0.4/include/new_gc_alloc.h Examining data/libgc-8.0.4/include/gc_alloc_ptrs.h Examining data/libgc-8.0.4/include/gc_pthread_redirects.h Examining data/libgc-8.0.4/include/extra/gc.h Examining data/libgc-8.0.4/include/extra/gc_cpp.h Examining data/libgc-8.0.4/include/cord.h Examining data/libgc-8.0.4/include/gc.h Examining data/libgc-8.0.4/include/cord_pos.h Examining data/libgc-8.0.4/include/leak_detector.h Examining data/libgc-8.0.4/include/javaxfc.h Examining data/libgc-8.0.4/include/gc_mark.h Examining data/libgc-8.0.4/include/ec.h Examining data/libgc-8.0.4/include/gc_cpp.h Examining data/libgc-8.0.4/include/gc_tiny_fl.h Examining data/libgc-8.0.4/include/gc_version.h Examining data/libgc-8.0.4/include/gc_allocator.h Examining data/libgc-8.0.4/include/gc_inline.h Examining data/libgc-8.0.4/include/gc_backptr.h Examining data/libgc-8.0.4/include/gc_typed.h Examining data/libgc-8.0.4/include/gc_config_macros.h Examining data/libgc-8.0.4/typd_mlc.c Examining data/libgc-8.0.4/alloc.c Examining data/libgc-8.0.4/malloc.c Examining data/libgc-8.0.4/misc.c Examining data/libgc-8.0.4/mark_rts.c Examining data/libgc-8.0.4/mark.c Examining data/libgc-8.0.4/pthread_stop_world.c Examining data/libgc-8.0.4/headers.c Examining data/libgc-8.0.4/extra/AmigaOS.c Examining data/libgc-8.0.4/extra/pcr_interface.c Examining data/libgc-8.0.4/extra/symbian.cpp Examining data/libgc-8.0.4/extra/MacOS.c Examining data/libgc-8.0.4/extra/msvc_dbg.c Examining data/libgc-8.0.4/extra/gc.c Examining data/libgc-8.0.4/extra/real_malloc.c Examining data/libgc-8.0.4/extra/symbian/global_start.cpp Examining data/libgc-8.0.4/extra/symbian/global_end.cpp Examining data/libgc-8.0.4/extra/symbian/init_global_static_roots.cpp Examining data/libgc-8.0.4/extra/Mac_files/dataend.c Examining data/libgc-8.0.4/extra/Mac_files/datastart.c Examining data/libgc-8.0.4/extra/Mac_files/MacOS_config.h Examining data/libgc-8.0.4/allchblk.c Examining data/libgc-8.0.4/thread_local_alloc.c Examining data/libgc-8.0.4/tests/trace_test.c Examining data/libgc-8.0.4/tests/smash_test.c Examining data/libgc-8.0.4/tests/subthread_create.c Examining data/libgc-8.0.4/tests/test_atomic_ops.c Examining data/libgc-8.0.4/tests/disclaim_bench.c Examining data/libgc-8.0.4/tests/disclaim_weakmap_test.c Examining data/libgc-8.0.4/tests/middle.c Examining data/libgc-8.0.4/tests/threadkey_test.c Examining data/libgc-8.0.4/tests/initsecondarythread.c Examining data/libgc-8.0.4/tests/staticrootstest.c Examining data/libgc-8.0.4/tests/test_cpp.cc Examining data/libgc-8.0.4/tests/disclaim_test.c Examining data/libgc-8.0.4/tests/huge_test.c Examining data/libgc-8.0.4/tests/test.c Examining data/libgc-8.0.4/tests/staticrootslib.c Examining data/libgc-8.0.4/tests/realloc_test.c Examining data/libgc-8.0.4/tests/leak_test.c Examining data/libgc-8.0.4/tests/thread_leak_test.c Examining data/libgc-8.0.4/dyn_load.c Examining data/libgc-8.0.4/gc_cpp.cpp Examining data/libgc-8.0.4/obj_map.c Examining data/libgc-8.0.4/checksums.c Examining data/libgc-8.0.4/pthread_start.c Examining data/libgc-8.0.4/win32_threads.c Examining data/libgc-8.0.4/fnlz_mlc.c Examining data/libgc-8.0.4/finalize.c Examining data/libgc-8.0.4/dbg_mlc.c Examining data/libgc-8.0.4/gc_cpp.cc Examining data/libgc-8.0.4/mallocx.c Examining data/libgc-8.0.4/ptr_chck.c Examining data/libgc-8.0.4/cord/tests/de_win.c Examining data/libgc-8.0.4/cord/tests/de_win.h Examining data/libgc-8.0.4/cord/tests/cordtest.c Examining data/libgc-8.0.4/cord/tests/de.c Examining data/libgc-8.0.4/cord/tests/de_cmds.h Examining data/libgc-8.0.4/cord/cordbscs.c Examining data/libgc-8.0.4/cord/cordxtra.c Examining data/libgc-8.0.4/cord/cordprnt.c Examining data/libgc-8.0.4/tools/if_mach.c Examining data/libgc-8.0.4/tools/if_not_there.c Examining data/libgc-8.0.4/tools/threadlibs.c Examining data/libgc-8.0.4/tools/setjmp_t.c Examining data/libgc-8.0.4/blacklst.c Examining data/libgc-8.0.4/mach_dep.c Examining data/libgc-8.0.4/pthread_support.c Examining data/libgc-8.0.4/backgraph.c Examining data/libgc-8.0.4/os_dep.c FINAL RESULTS: data/libgc-8.0.4/os_dep.c:4727:30: [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. ret_code = readlink("/proc/self/exe", exe_name, EXE_SZ); data/libgc-8.0.4/cord/cordprnt.c:179:49: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. # define GC_VSNPRINTF(buf, bufsz, format, args) vsprintf(buf, format, args) data/libgc-8.0.4/cord/cordprnt.c:188:23: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define GC_VSNPRINTF vsnprintf data/libgc-8.0.4/cord/tests/cordtest.c:263:26: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define GC_SNPRINTF _snprintf data/libgc-8.0.4/cord/tests/cordtest.c:266:24: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define GC_SNPRINTF snprintf data/libgc-8.0.4/cord/tests/de.c:68:30: [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. # define de_error(s) { fprintf(stderr, s); getchar(); } data/libgc-8.0.4/cord/tests/de.c:74:25: [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. # define de_error(s) { fprintf(stderr, s); sleep(2); } data/libgc-8.0.4/dyn_load.c:1363:13: [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. (void)snprintf(secnam, sizeof(secnam), fmt, (unsigned)i); data/libgc-8.0.4/dyn_load.c:1421:13: [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. (void)snprintf(secnam, sizeof(secnam), fmt, (unsigned)i); data/libgc-8.0.4/misc.c:1758:49: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. # define GC_VSNPRINTF(buf, bufsz, format, args) vsprintf(buf, format, args) data/libgc-8.0.4/misc.c:1767:23: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define GC_VSNPRINTF vsnprintf data/libgc-8.0.4/os_dep.c:4753:24: [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. pipe = popen(cmd_buf, "r"); data/libgc-8.0.4/tests/huge_test.c:40:9: [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, \ data/libgc-8.0.4/tests/test.c:98:22: [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. # define GC_printf printf data/libgc-8.0.4/tools/if_mach.c:24:5: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(TRUSTED_STRING(argv[3]), (EXECV_ARGV_T)(argv + 3)); data/libgc-8.0.4/tools/if_not_there.c:52:5: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(TRUSTED_STRING(argv[2]), (EXECV_ARGV_T)(argv + 2)); data/libgc-8.0.4/dbg_mlc.c:78: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. # define RANDOM() random() data/libgc-8.0.4/include/private/gc_locks.h:87:19: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&GC_allocate_ml); \ data/libgc-8.0.4/include/private/gc_locks.h:93:29: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. # define UNCOND_LOCK() EnterCriticalSection(&GC_allocate_ml) data/libgc-8.0.4/include/private/gc_priv.h:665:19: [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 *value = getenv(name); data/libgc-8.0.4/include/private/gc_priv.h:670: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. # define GETENV(name) getenv(name) data/libgc-8.0.4/misc.c:719:11: [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. p = getenv(name); /* try the standard getenv() first */ data/libgc-8.0.4/misc.c:829:24: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. HINSTANCE hU32 = LoadLibrary(TEXT("user32.dll")); data/libgc-8.0.4/misc.c:970:22: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. /* else */ InitializeCriticalSection(&GC_allocate_ml); data/libgc-8.0.4/misc.c:975:7: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&GC_write_cs); data/libgc-8.0.4/misc.c:1617:23: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. IF_NEED_TO_LOCK(EnterCriticalSection(&GC_write_cs)); data/libgc-8.0.4/tests/test.c:142:27: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. # define FINALIZER_LOCK() EnterCriticalSection(&incr_cs) data/libgc-8.0.4/tests/test.c:2186:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&incr_cs); data/libgc-8.0.4/win32_threads.c:1239:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&GC_write_cs); data/libgc-8.0.4/cord/cordbscs.c:80: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 string[1]; data/libgc-8.0.4/cord/cordbscs.c:174:17: [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(result, x, lenx + 1); data/libgc-8.0.4/cord/cordbscs.c:176:17: [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(result, x, lenx); data/libgc-8.0.4/cord/cordbscs.c:180: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(result + lenx, y, leny); data/libgc-8.0.4/cord/cordbscs.c:210:17: [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_right, right, right_len); data/libgc-8.0.4/cord/cordbscs.c:211:17: [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_right + right_len, y, leny); data/libgc-8.0.4/cord/cordbscs.c:299: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[SHORT_LIMIT+1]; data/libgc-8.0.4/cord/cordbscs.c:310: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(result, buf, len); data/libgc-8.0.4/cord/cordbscs.c:446:13: [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[SUBSTR_LIMIT+1]; data/libgc-8.0.4/cord/cordbscs.c:461: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(result, buf, n); data/libgc-8.0.4/cord/cordprnt.c:197: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 conv_spec[CONV_SPEC_LEN + 1]; data/libgc-8.0.4/cord/cordxtra.c:265: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(result, s, len+1); data/libgc-8.0.4/cord/cordxtra.c:440: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(s, x[0].ec_buf, len); data/libgc-8.0.4/cord/cordxtra.c:507: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 data[LINE_SZ]; data/libgc-8.0.4/cord/cordxtra.c:595: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[1]; data/libgc-8.0.4/cord/tests/cordtest.c:170: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). if ((f = fopen(FNAME1, "w")) == 0) ABORT("open failed"); data/libgc-8.0.4/cord/tests/cordtest.c:173:11: [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). f1a = fopen(FNAME1, "rb"); data/libgc-8.0.4/cord/tests/cordtest.c:180:11: [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). f1b = fopen(FNAME1, "rb"); data/libgc-8.0.4/cord/tests/cordtest.c:191: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). if ((f = fopen(FNAME2, "w")) == 0) ABORT("2nd open failed"); data/libgc-8.0.4/cord/tests/cordtest.c:198:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f2 = fopen(FNAME2, "rb"); data/libgc-8.0.4/cord/tests/cordtest.c:273: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 result2[200]; data/libgc-8.0.4/cord/tests/cordtest.c:296:15: [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. (void)sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x)); data/libgc-8.0.4/cord/tests/de.c:527:28: [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). if ((out = fopen(CORD_to_const_char_star(name), "wb")) == NULL data/libgc-8.0.4/cord/tests/de.c:567: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). if ((f = fopen(arg_file_name, "rb")) == NULL) { data/libgc-8.0.4/cord/tests/de_win.c:139:31: [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. if (iscntrl(((unsigned char *)text)[i])) { data/libgc-8.0.4/cord/tests/de_win.c:158:31: [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. if (iscntrl(((unsigned char *)text)[i])) { data/libgc-8.0.4/dbg_mlc.c:374:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[GC_TYPE_DESCR_LEN + 1]; data/libgc-8.0.4/dyn_load.c:815: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[30]; data/libgc-8.0.4/dyn_load.c:833: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). fd = open(buf, O_RDONLY); data/libgc-8.0.4/dyn_load.c:1228: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 ldibuf[ldibuflen]; data/libgc-8.0.4/dyn_load.c:1361:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char secnam[16]; data/libgc-8.0.4/dyn_load.c:1419:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char secnam[16]; data/libgc-8.0.4/extra/msvc_dbg.c:83: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 filePath[_MAX_PATH]; data/libgc-8.0.4/extra/msvc_dbg.c: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 curDir[_MAX_PATH]; data/libgc-8.0.4/extra/msvc_dbg.c:85: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 exePath[_MAX_PATH]; data/libgc-8.0.4/extra/msvc_dbg.c:95:5: [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(exePath, "\\.."); data/libgc-8.0.4/extra/msvc_dbg.c: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 symNameBuffer[sizeof(IMAGEHLP_SYMBOL) + MAX_SYM_NAME]; data/libgc-8.0.4/extra/msvc_dbg.c:237:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char undName[1024]; data/libgc-8.0.4/extra/msvc_dbg.c:326: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 str[128]; data/libgc-8.0.4/extra/symbian.cpp:47: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( copyChar, path8.PtrZ(), size ); data/libgc-8.0.4/include/cord_pos.h:57: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 function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */ data/libgc-8.0.4/include/ec.h:44: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 ec_buf[CORD_BUFSZ+1]; data/libgc-8.0.4/include/private/gc_priv.h:507:12: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define bcopy(x,y,n) BlockMoveData(x, y, n) data/libgc-8.0.4/include/private/gc_priv.h:514:25: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define BCOPY(x,y,n) memcpy(y, x, (size_t)(n)) data/libgc-8.0.4/include/private/gc_priv.h:517:25: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define BCOPY(x,y,n) bcopy((void *)(x),(void *)(y),(size_t)(n)) data/libgc-8.0.4/include/private/gc_priv.h:1104: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 _hb_marks[MARK_BITS_SZ]; data/libgc-8.0.4/include/private/gc_priv.h:1132: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 hb_body[HBLKSIZE]; data/libgc-8.0.4/include/private/gc_priv.h:1314: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 _modws_valid_offsets[sizeof(word)]; data/libgc-8.0.4/include/private/gc_priv.h:1367: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 _valid_offsets[VALID_OFFSET_SZ]; data/libgc-8.0.4/include/private/gc_priv.h:2511: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. do { if (0) { char j[(expr)? 1 : -1]; j[0]='\0'; j[0]=j[0]; } } while(0) data/libgc-8.0.4/include/private/pthread_support.h:50:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dummy[sizeof(oh)]; /* A dummy field to avoid TSan false */ data/libgc-8.0.4/misc.c:663:7: [2] (buffer) TCHAR: 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. TCHAR path[_MAX_PATH + 0x10]; /* buffer for path + ext */ data/libgc-8.0.4/misc.c:1008:25: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int log_d = open(file_name, O_CREAT | O_WRONLY | O_APPEND, 0644); data/libgc-8.0.4/misc.c:1042:27: [2] (integer) atol: 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). GC_backtraces = atol(backtraces_string); data/libgc-8.0.4/misc.c:1094:29: [2] (integer) atol: 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). long time_limit = atol(time_limit_string); data/libgc-8.0.4/misc.c:1108:27: [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 full_freq = atoi(full_freq_string); data/libgc-8.0.4/misc.c:1117:25: [2] (integer) atol: 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). long interval = atol(interval_string); data/libgc-8.0.4/misc.c:1129:31: [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 space_divisor = atoi(space_divisor_string); data/libgc-8.0.4/misc.c:1142:35: [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 unmap_threshold = atoi(string); data/libgc-8.0.4/misc.c:1538:7: [2] (buffer) TCHAR: 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. TCHAR pathBuf[_MAX_PATH + 0x10]; /* buffer for path + ext */ data/libgc-8.0.4/misc.c:1557:7: [2] (buffer) TCHAR: 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. TCHAR pathBuf[_MAX_PATH + 0x10]; /* buffer for path + ext */ data/libgc-8.0.4/misc.c:1789:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[BUFSZ + 1]; data/libgc-8.0.4/misc.c:1804: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[BUFSZ + 1]; data/libgc-8.0.4/misc.c:1812: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[BUFSZ + 1]; data/libgc-8.0.4/misc.c:1831: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[BUFSZ + 1]; data/libgc-8.0.4/misc.c:1839: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[BUFSZ + 1]; data/libgc-8.0.4/misc.c:1847: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[BUFSZ + 1]; data/libgc-8.0.4/os_dep.c:145: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[GET_FILE_LEN_BUF_SZ]; data/libgc-8.0.4/os_dep.c:157:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int f = open("/proc/self/maps", O_RDONLY); data/libgc-8.0.4/os_dep.c:226: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). f = open("/proc/self/maps", O_RDONLY); data/libgc-8.0.4/os_dep.c:471: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 ecos_gc_memory[ECOS_GC_MEMORY_SIZE]; data/libgc-8.0.4/os_dep.c:630:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char magic_number[2]; data/libgc-8.0.4/os_dep.c:1100: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 stat_buf[STAT_BUF_SIZE]; data/libgc-8.0.4/os_dep.c:1129:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = open("/proc/self/stat", O_RDONLY); data/libgc-8.0.4/os_dep.c:1550:17: [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). myexefile = fopen(path, "rb"); data/libgc-8.0.4/os_dep.c:2151:23: [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). zero_fd = open(path, O_RDWR | O_CREAT, 0644); data/libgc-8.0.4/os_dep.c:2155: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). zero_fd = open("/dev/zero", O_RDONLY); data/libgc-8.0.4/os_dep.c:3512:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dummy1[64+8]; /* pr_mapname, pr_offset */ data/libgc-8.0.4/os_dep.c:3529: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[40]; data/libgc-8.0.4/os_dep.c:3540: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). GC_proc_fd = open(buf, O_RDONLY); data/libgc-8.0.4/os_dep.c:4021: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 data[256]; data/libgc-8.0.4/os_dep.c:4027: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 data[1024]; data/libgc-8.0.4/os_dep.c:4690: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 buf[40]; data/libgc-8.0.4/os_dep.c:4711:24: [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 exe_name[EXE_SZ]; data/libgc-8.0.4/os_dep.c:4713:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cmd_buf[CMD_SZ]; data/libgc-8.0.4/os_dep.c:4715:24: [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 result_buf[RESULT_SZ]; data/libgc-8.0.4/os_dep.c:4719:17: [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 preload_buf[PRELOAD_SZ]; data/libgc-8.0.4/pthread_support.c:923: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 stat_buf[STAT_BUF_SIZE]; data/libgc-8.0.4/pthread_support.c:927:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = open("/proc/stat", O_RDONLY); data/libgc-8.0.4/pthread_support.c:943: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). int cpu_no = atoi(&stat_buf[i + 4]); data/libgc-8.0.4/pthread_support.c:993: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 stat_buf[16]; data/libgc-8.0.4/pthread_support.c:997:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = open("/sys/devices/system/cpu/present", O_RDONLY); data/libgc-8.0.4/pthread_support.c:1016:12: [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). return atoi(&stat_buf[2]) + 1; /* skip "0-" and parse max_cpu_num */ data/libgc-8.0.4/pthread_support.c:1253:44: [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 (nprocs_string != NULL) GC_nprocs = atoi(nprocs_string); data/libgc-8.0.4/pthread_support.c:1277: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). markers = atoi(markers_string); data/libgc-8.0.4/tests/disclaim_bench.c:93: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 const *model_str[3] = { data/libgc-8.0.4/tests/disclaim_bench.c:116:54: [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). model_min = model_max = (int)COVERT_DATAFLOW(atoi(argv[1])); data/libgc-8.0.4/tests/disclaim_test.c:94: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 magic[16]; data/libgc-8.0.4/tests/disclaim_weakmap_test.c:193: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((char *)old_obj + key_size, (char *)obj + key_size, data/libgc-8.0.4/tests/disclaim_weakmap_test.c:212: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(new_obj, obj, wm->obj_size); data/libgc-8.0.4/tests/disclaim_weakmap_test.c:340:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char magic[PAIR_MAGIC_SIZE]; data/libgc-8.0.4/tests/disclaim_weakmap_test.c:354: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(tmpl.magic, pair_magic, PAIR_MAGIC_SIZE); data/libgc-8.0.4/tests/smash_test.c:14:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char * A[COUNT]; data/libgc-8.0.4/tests/test_cpp.cc:339:38: [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). || (n = (int)COVERT_DATAFLOW(atoi(argv[1]))) <= 0) { data/libgc-8.0.4/tools/if_not_there.c:31:9: [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). f = fopen(fname, "rb"); data/libgc-8.0.4/tools/if_not_there.c:36:9: [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). f = fopen(fname, "r"); data/libgc-8.0.4/win32_threads.c:2534: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). markers = atoi(markers_string); data/libgc-8.0.4/cord/cordbscs.c:101: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). #define GEN_LEN(s) (CORD_IS_STRING(s) ? strlen(s) : LEN(s)) data/libgc-8.0.4/cord/cordbscs.c:167:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lenx = strlen(x); data/libgc-8.0.4/cord/cordbscs.c:204: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). right_len = strlen(right); data/libgc-8.0.4/cord/cordbscs.c:260: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). return(CORD_cat_char_star(x, y, strlen(y))); data/libgc-8.0.4/cord/cordbscs.c:262:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lenx = strlen(x); data/libgc-8.0.4/cord/cordbscs.c:395:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result, x+i, n); data/libgc-8.0.4/cord/cordprnt.c:358: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). len = strlen(buf); data/libgc-8.0.4/cord/cordxtra.c:260:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(s); data/libgc-8.0.4/cord/cordxtra.c:339:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). d -> pos += strlen(s); data/libgc-8.0.4/cord/cordxtra.c:397:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). slen = strlen(s); data/libgc-8.0.4/cord/cordxtra.c:468:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(f); data/libgc-8.0.4/cord/cordxtra.c:477:25: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(f)) == 0) count++; data/libgc-8.0.4/cord/tests/de.c:68:50: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define de_error(s) { fprintf(stderr, s); getchar(); } data/libgc-8.0.4/cord/tests/de.c:620:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getchar()) != QUIT) { data/libgc-8.0.4/cord/tests/de_win.c:343:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). control, (int)strlen(control)); data/libgc-8.0.4/dbg_mlc.c:660:8: [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). lb = strlen(str) + 1; data/libgc-8.0.4/dbg_mlc.c:676:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(str); /* str is expected to be non-NULL */ data/libgc-8.0.4/dbg_mlc.c:698:18: [1] (buffer) wcslen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t lb = (wcslen(str) + 1) * sizeof(wchar_t); data/libgc-8.0.4/extra/msvc_dbg.c:199:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(moduleName, sourceName, size)[size - 1] = 0; data/libgc-8.0.4/extra/msvc_dbg.c:201: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). return strlen(sourceName); data/libgc-8.0.4/extra/msvc_dbg.c:248:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(symbolName, sourceName, size)[size - 1] = 0; data/libgc-8.0.4/extra/msvc_dbg.c:250:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return strlen(sourceName); data/libgc-8.0.4/extra/msvc_dbg.c:293:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fileName, sourceName, size)[size - 1] = 0; data/libgc-8.0.4/extra/msvc_dbg.c:295: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). return strlen(sourceName); data/libgc-8.0.4/extra/msvc_dbg.c:330:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, str, size)[size - 1] = 0; data/libgc-8.0.4/extra/msvc_dbg.c:332: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). buffer += strlen(str); data/libgc-8.0.4/extra/msvc_dbg.c:337:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buffer, "at ", size)[size - 1] = 0; data/libgc-8.0.4/extra/msvc_dbg.c:346:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buffer, " in ", size)[size - 1] = 0; data/libgc-8.0.4/include/leak_detector.h:55:8: [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. #undef memalign data/libgc-8.0.4/include/leak_detector.h:56: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. #define memalign(a,n) GC_memalign(a,n) data/libgc-8.0.4/malloc.c:518: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). size_t lb = strlen(s) + 1; data/libgc-8.0.4/malloc.c:537:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(str); data/libgc-8.0.4/mallocx.c:563:8: [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). lb = strlen(s) + 1; data/libgc-8.0.4/mallocx.c:578:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(str); /* str is expected to be non-NULL */ data/libgc-8.0.4/mallocx.c:599:18: [1] (buffer) wcslen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t lb = (wcslen(str) + 1) * sizeof(wchar_t); data/libgc-8.0.4/misc.c:726: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). namelen = strlen(name); data/libgc-8.0.4/misc.c:730:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p != end_of_content; p += strlen(p) + 1) { data/libgc-8.0.4/misc.c:1644:24: [1] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). Risk is very low, the length appears to be in characters not bytes. wbuf[MultiByteToWideChar(CP_ACP, 0 /* dwFlags */, data/libgc-8.0.4/misc.c:1793: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). (void)WRITE(GC_stdout, buf, strlen(buf)); data/libgc-8.0.4/misc.c:1796:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (WRITE(GC_stdout, buf, strlen(buf)) < 0) data/libgc-8.0.4/misc.c:1816: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). (void)WRITE(GC_log, buf, strlen(buf)); data/libgc-8.0.4/misc.c:1818:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (WRITE(GC_log, buf, strlen(buf)) < 0) data/libgc-8.0.4/misc.c:1857: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). (void)WRITE(GC_stderr, s, strlen(s)); /* ignore errors */ data/libgc-8.0.4/misc.c:1929:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (WRITE(GC_stderr, msg, strlen(msg)) >= 0) data/libgc-8.0.4/os_dep.c:121:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define READ read data/libgc-8.0.4/os_dep.c:148:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read(f, buf, GET_FILE_LEN_BUF_SZ); data/libgc-8.0.4/os_dep.c:362:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t nm_len = strlen(nm); data/libgc-8.0.4/os_dep.c:1097:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define STAT_READ read data/libgc-8.0.4/os_dep.c:3556:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define READ read data/libgc-8.0.4/os_dep.c:4745:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t old_len = strlen(old_preload); data/libgc-8.0.4/pthread_stop_world.c:473:11: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(WAIT_UNIT); data/libgc-8.0.4/pthread_support.c:892:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define STAT_READ read data/libgc-8.0.4/tools/if_mach.c:20: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(OS_TYPE) > 0 && strlen(argv[2]) > 0 data/libgc-8.0.4/tools/if_mach.c:20: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). if (strlen(OS_TYPE) > 0 && strlen(argv[2]) > 0 data/libgc-8.0.4/tools/setjmp_t.c:89: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). register int x = (int)strlen("a"); /* 1, slightly disguised */ ANALYSIS SUMMARY: Hits = 191 Lines analyzed = 55263 in approximately 1.54 seconds (35995 lines/second) Physical Source Lines of Code (SLOC) = 39245 Hits@level = [0] 160 [1] 55 [2] 107 [3] 13 [4] 15 [5] 1 Hits@level+ = [0+] 351 [1+] 191 [2+] 136 [3+] 29 [4+] 16 [5+] 1 Hits/KSLOC@level+ = [0+] 8.94381 [1+] 4.86686 [2+] 3.46541 [3+] 0.738948 [4+] 0.407695 [5+] 0.025481 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.