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/libnative-platform-java-0.14/src/curses/cpp/curses.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/apple.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/freebsd.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/freebsd_kevents.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/linux.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/posix.cpp Examining data/libnative-platform-java-0.14/src/main/cpp/win.cpp Examining data/libnative-platform-java-0.14/src/shared/cpp/generic.cpp Examining data/libnative-platform-java-0.14/src/shared/cpp/generic_posix.cpp Examining data/libnative-platform-java-0.14/src/shared/cpp/osx.cpp Examining data/libnative-platform-java-0.14/src/shared/cpp/unix_strings.cpp Examining data/libnative-platform-java-0.14/src/shared/headers/generic.h FINAL RESULTS: data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:73:18: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. int retval = chmod(pathStr, mode); data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:260:14: [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. retval = readlink(pathStr, contents, link_info.st_size); data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:192:9: [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(childPath+pathLen+1, entry.d_name); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:217:13: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(devPath, 7, L"\\\\.\\%s", cur); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:256:21: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(fileSystemName, MAX_PATH+1, L"cdrom"); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:258:21: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(fileSystemName, MAX_PATH+1, L"unknown"); data/libnative-platform-java-0.14/src/curses/cpp/curses.cpp:98: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. char* termType = getenv("TERM"); data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:319:22: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* valueStr = getenv(varStr); data/libnative-platform-java-0.14/src/main/cpp/freebsd_kevents.cpp:46:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int event_fd = open(pathStr, O_EVTONLY); data/libnative-platform-java-0.14/src/main/cpp/freebsd_kevents.cpp:48:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int event_fd = open(pathStr, O_RDONLY); data/libnative-platform-java-0.14/src/main/cpp/linux.cpp:41: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[1024]; data/libnative-platform-java-0.14/src/main/cpp/win.cpp:216:13: [2] (buffer) wchar_t: 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. wchar_t devPath[7]; data/libnative-platform-java-0.14/src/main/cpp/linux.cpp:93:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t read_count = read(details->watch_fd, buffer, len); data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:167: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). long pathLen = strlen(pathStr); data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:188: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). size_t childPathLen = pathLen + strlen(entry.d_name) + 2; data/libnative-platform-java-0.14/src/main/cpp/posix.cpp:190:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(childPath, pathStr, pathLen); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:207:39: [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). for (;cur[0] != L'\0'; cur += wcslen(cur) + 1) { data/libnative-platform-java-0.14/src/main/cpp/win.cpp:212:26: [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 len = wcslen(cur); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:263:57: [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). wchar_to_java(env, cur, wcslen(cur), result), data/libnative-platform-java-0.14/src/main/cpp/win.cpp:264:68: [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). wchar_to_java(env, fileSystemName, wcslen(fileSystemName), result), data/libnative-platform-java-0.14/src/main/cpp/win.cpp:265:64: [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). wchar_to_java(env, deviceName, wcslen(deviceName), result), data/libnative-platform-java-0.14/src/main/cpp/win.cpp:376:65: [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). jstring childName = wchar_to_java(env, entry.cFileName, wcslen(entry.cFileName), result); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:663:48: [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). jstring jvalue = wchar_to_java(env, value, wcslen(value), result); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:699:81: [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). env->CallVoidMethod(subkeys, method, wchar_to_java(env, keyNameStr, wcslen(keyNameStr), result)); data/libnative-platform-java-0.14/src/main/cpp/win.cpp:739:81: [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). env->CallVoidMethod(names, method, wchar_to_java(env, valueNameStr, wcslen(valueNameStr), result)); data/libnative-platform-java-0.14/src/shared/cpp/unix_strings.cpp:53: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 bytes = strlen(chars); data/libnative-platform-java-0.14/src/shared/cpp/unix_strings.cpp:60:24: [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 stringLen = wcslen(wideString); ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 2101 in approximately 0.09 seconds (22491 lines/second) Physical Source Lines of Code (SLOC) = 1573 Hits@level = [0] 0 [1] 15 [2] 4 [3] 2 [4] 4 [5] 2 Hits@level+ = [0+] 27 [1+] 27 [2+] 12 [3+] 8 [4+] 6 [5+] 2 Hits/KSLOC@level+ = [0+] 17.1647 [1+] 17.1647 [2+] 7.62873 [3+] 5.08582 [4+] 3.81437 [5+] 1.27146 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.