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/watchman-4.9.0/ChildProcess.cpp Examining data/watchman-4.9.0/ChildProcess.h Examining data/watchman-4.9.0/ContentHash.cpp Examining data/watchman-4.9.0/ContentHash.h Examining data/watchman-4.9.0/CookieSync.cpp Examining data/watchman-4.9.0/CookieSync.h Examining data/watchman-4.9.0/FileDescriptor.cpp Examining data/watchman-4.9.0/FileDescriptor.h Examining data/watchman-4.9.0/FileInformation.cpp Examining data/watchman-4.9.0/FileInformation.h Examining data/watchman-4.9.0/FileSystem.h Examining data/watchman-4.9.0/Future.h Examining data/watchman-4.9.0/InMemoryView.cpp Examining data/watchman-4.9.0/InMemoryView.h Examining data/watchman-4.9.0/LRUCache.h Examining data/watchman-4.9.0/Logging.h Examining data/watchman-4.9.0/Pipe.cpp Examining data/watchman-4.9.0/Pipe.h Examining data/watchman-4.9.0/PubSub.cpp Examining data/watchman-4.9.0/PubSub.h Examining data/watchman-4.9.0/QueryableView.cpp Examining data/watchman-4.9.0/QueryableView.h Examining data/watchman-4.9.0/Result.h Examining data/watchman-4.9.0/ThreadPool.cpp Examining data/watchman-4.9.0/ThreadPool.h Examining data/watchman-4.9.0/bser.cpp Examining data/watchman-4.9.0/cfg.cpp Examining data/watchman-4.9.0/checksock.cpp Examining data/watchman-4.9.0/clientmode.cpp Examining data/watchman-4.9.0/clockspec.cpp Examining data/watchman-4.9.0/cmds/debug.cpp Examining data/watchman-4.9.0/cmds/find.cpp Examining data/watchman-4.9.0/cmds/info.cpp Examining data/watchman-4.9.0/cmds/log.cpp Examining data/watchman-4.9.0/cmds/query.cpp Examining data/watchman-4.9.0/cmds/reg.cpp Examining data/watchman-4.9.0/cmds/since.cpp Examining data/watchman-4.9.0/cmds/state.cpp Examining data/watchman-4.9.0/cmds/subscribe.cpp Examining data/watchman-4.9.0/cmds/trigger.cpp Examining data/watchman-4.9.0/cmds/watch.cpp Examining data/watchman-4.9.0/cppclient/CLI.cpp Examining data/watchman-4.9.0/cppclient/WatchmanClient.cpp Examining data/watchman-4.9.0/cppclient/WatchmanClient.h Examining data/watchman-4.9.0/cppclient/WatchmanConnection.cpp Examining data/watchman-4.9.0/cppclient/WatchmanConnection.h Examining data/watchman-4.9.0/cppclient/WatchmanResponseError.cpp Examining data/watchman-4.9.0/error_category.cpp Examining data/watchman-4.9.0/expflags.cpp Examining data/watchman-4.9.0/fstype.cpp Examining data/watchman-4.9.0/hash.cpp Examining data/watchman-4.9.0/ignore.cpp Examining data/watchman-4.9.0/ioprio.cpp Examining data/watchman-4.9.0/json.cpp Examining data/watchman-4.9.0/launchd.cpp Examining data/watchman-4.9.0/listener-user.cpp Examining data/watchman-4.9.0/listener.cpp Examining data/watchman-4.9.0/log.cpp Examining data/watchman-4.9.0/main.cpp Examining data/watchman-4.9.0/make_unique.h Examining data/watchman-4.9.0/opendir.cpp Examining data/watchman-4.9.0/opt.cpp Examining data/watchman-4.9.0/pending.cpp Examining data/watchman-4.9.0/perf.cpp Examining data/watchman-4.9.0/python/pywatchman/bser.c Examining data/watchman-4.9.0/query/base.cpp Examining data/watchman-4.9.0/query/dirname.cpp Examining data/watchman-4.9.0/query/empty.cpp Examining data/watchman-4.9.0/query/eval.cpp Examining data/watchman-4.9.0/query/fieldlist.cpp Examining data/watchman-4.9.0/query/glob.cpp Examining data/watchman-4.9.0/query/intcompare.cpp Examining data/watchman-4.9.0/query/match.cpp Examining data/watchman-4.9.0/query/name.cpp Examining data/watchman-4.9.0/query/parse.cpp Examining data/watchman-4.9.0/query/pcre.cpp Examining data/watchman-4.9.0/query/since.cpp Examining data/watchman-4.9.0/query/suffix.cpp Examining data/watchman-4.9.0/query/type.cpp Examining data/watchman-4.9.0/root/ageout.cpp Examining data/watchman-4.9.0/root/crawler.cpp Examining data/watchman-4.9.0/root/dir.cpp Examining data/watchman-4.9.0/root/file.cpp Examining data/watchman-4.9.0/root/init.cpp Examining data/watchman-4.9.0/root/iothread.cpp Examining data/watchman-4.9.0/root/notifythread.cpp Examining data/watchman-4.9.0/root/poison.cpp Examining data/watchman-4.9.0/root/reap.cpp Examining data/watchman-4.9.0/root/resolve.cpp Examining data/watchman-4.9.0/root/stat.cpp Examining data/watchman-4.9.0/root/symlink.cpp Examining data/watchman-4.9.0/root/sync.cpp Examining data/watchman-4.9.0/root/threading.cpp Examining data/watchman-4.9.0/root/vcs.cpp Examining data/watchman-4.9.0/root/warnerr.cpp Examining data/watchman-4.9.0/root/watchlist.cpp Examining data/watchman-4.9.0/ruby/ruby-watchman/ext/ruby-watchman/watchman.c Examining data/watchman-4.9.0/ruby/ruby-watchman/ext/ruby-watchman/watchman.h Examining data/watchman-4.9.0/scm/Mercurial.cpp Examining data/watchman-4.9.0/scm/Mercurial.h Examining data/watchman-4.9.0/scm/SCM.cpp Examining data/watchman-4.9.0/scm/SCM.h Examining data/watchman-4.9.0/spawn.cpp Examining data/watchman-4.9.0/state.cpp Examining data/watchman-4.9.0/stream.cpp Examining data/watchman-4.9.0/stream_stdout.cpp Examining data/watchman-4.9.0/stream_unix.cpp Examining data/watchman-4.9.0/stream_win.cpp Examining data/watchman-4.9.0/string.cpp Examining data/watchman-4.9.0/tests/CacheTest.cpp Examining data/watchman-4.9.0/tests/FutureTest.cpp Examining data/watchman-4.9.0/tests/ResultTest.cpp Examining data/watchman-4.9.0/tests/art_test.cpp Examining data/watchman-4.9.0/tests/bser.cpp Examining data/watchman-4.9.0/tests/childproc.cpp Examining data/watchman-4.9.0/tests/ignore_test.cpp Examining data/watchman-4.9.0/tests/integration/cppclient.cpp Examining data/watchman-4.9.0/tests/log.cpp Examining data/watchman-4.9.0/tests/log_stub.cpp Examining data/watchman-4.9.0/tests/pending_test.cpp Examining data/watchman-4.9.0/tests/string_test.cpp Examining data/watchman-4.9.0/tests/wildmatch_test.cpp Examining data/watchman-4.9.0/thirdparty/jansson/dump.cpp Examining data/watchman-4.9.0/thirdparty/jansson/error.cpp Examining data/watchman-4.9.0/thirdparty/jansson/jansson.h Examining data/watchman-4.9.0/thirdparty/jansson/jansson_private.h Examining data/watchman-4.9.0/thirdparty/jansson/load.cpp Examining data/watchman-4.9.0/thirdparty/jansson/memory.cpp Examining data/watchman-4.9.0/thirdparty/jansson/pack_unpack.cpp Examining data/watchman-4.9.0/thirdparty/jansson/strbuffer.cpp Examining data/watchman-4.9.0/thirdparty/jansson/strbuffer.h Examining data/watchman-4.9.0/thirdparty/jansson/strconv.cpp Examining data/watchman-4.9.0/thirdparty/jansson/utf.cpp Examining data/watchman-4.9.0/thirdparty/jansson/utf.h Examining data/watchman-4.9.0/thirdparty/jansson/value.cpp Examining data/watchman-4.9.0/thirdparty/libart/src/art.h Examining data/watchman-4.9.0/thirdparty/libart/src/art-inl.h Examining data/watchman-4.9.0/thirdparty/libart/tests/runner.c Examining data/watchman-4.9.0/thirdparty/tap.cpp Examining data/watchman-4.9.0/thirdparty/tap.h Examining data/watchman-4.9.0/thirdparty/wildmatch/wildmatch.c Examining data/watchman-4.9.0/thirdparty/wildmatch/wildmatch.h Examining data/watchman-4.9.0/time.cpp Examining data/watchman-4.9.0/timedlock.cpp Examining data/watchman-4.9.0/watcher/auto.cpp Examining data/watchman-4.9.0/watcher/eden.cpp Examining data/watchman-4.9.0/watcher/fsevents.cpp Examining data/watchman-4.9.0/watcher/inotify.cpp Examining data/watchman-4.9.0/watcher/kqueue.cpp Examining data/watchman-4.9.0/watcher/win32.cpp Examining data/watchman-4.9.0/watchman.h Examining data/watchman-4.9.0/watchman_client.h Examining data/watchman-4.9.0/watchman_clockspec.h Examining data/watchman-4.9.0/watchman_cmd.h Examining data/watchman-4.9.0/watchman_config.h Examining data/watchman-4.9.0/watchman_dir.h Examining data/watchman-4.9.0/watchman_error_category.h Examining data/watchman-4.9.0/watchman_file.h Examining data/watchman-4.9.0/watchman_getopt.h Examining data/watchman-4.9.0/watchman_hash.h Examining data/watchman-4.9.0/watchman_ignore.h Examining data/watchman-4.9.0/watchman_log.h Examining data/watchman-4.9.0/watchman_opendir.h Examining data/watchman-4.9.0/watchman_pdu.h Examining data/watchman-4.9.0/watchman_pending.h Examining data/watchman-4.9.0/watchman_perf.h Examining data/watchman-4.9.0/watchman_preprocessor.h Examining data/watchman-4.9.0/watchman_query.h Examining data/watchman-4.9.0/watchman_root.h Examining data/watchman-4.9.0/watchman_scopeguard.h Examining data/watchman-4.9.0/watchman_shared_mutex.h Examining data/watchman-4.9.0/watchman_stream.h Examining data/watchman-4.9.0/watchman_string.h Examining data/watchman-4.9.0/watchman_synchronized.h Examining data/watchman-4.9.0/watchman_system.h Examining data/watchman-4.9.0/watchman_time.h Examining data/watchman-4.9.0/watchman_trigger.h Examining data/watchman-4.9.0/watchman_watcher.h Examining data/watchman-4.9.0/winbuild/asprintf.cpp Examining data/watchman-4.9.0/winbuild/backtrace.cpp Examining data/watchman-4.9.0/winbuild/config.h Examining data/watchman-4.9.0/winbuild/dir.cpp Examining data/watchman-4.9.0/winbuild/errmap.cpp Examining data/watchman-4.9.0/winbuild/getopt.h Examining data/watchman-4.9.0/winbuild/getopt_long.cpp Examining data/watchman-4.9.0/winbuild/hostname.cpp Examining data/watchman-4.9.0/winbuild/jansson_config.h Examining data/watchman-4.9.0/winbuild/mkdir.cpp Examining data/watchman-4.9.0/winbuild/pathmap.cpp Examining data/watchman-4.9.0/winbuild/posix_spawn.cpp Examining data/watchman-4.9.0/winbuild/spawn.h Examining data/watchman-4.9.0/winbuild/susres.cpp Examining data/watchman-4.9.0/winbuild/sys/time.h Examining data/watchman-4.9.0/winbuild/time.cpp FINAL RESULTS: data/watchman-4.9.0/FileDescriptor.cpp:383: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. auto len = readlink(procpath, buf, sizeof(buf)); data/watchman-4.9.0/FileDescriptor.cpp:415:9: [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. len = readlink(procpath, &result[0], result.size()); data/watchman-4.9.0/FileDescriptor.cpp:467:16: [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. auto len = readlink(path, &result[0], result.size()); data/watchman-4.9.0/FileDescriptor.cpp:527: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. auto len = readlink(myName.c_str(), &result[0], result.size()); data/watchman-4.9.0/listener.cpp:373:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(path, perms) == -1) { data/watchman-4.9.0/main.cpp:482:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(plist_path, 0644); data/watchman-4.9.0/watcher/eden.cpp:77:16: [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. auto len = ::readlink(path.c_str(), &result[0], result.size()); data/watchman-4.9.0/CookieSync.cpp:45:29: [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. auto path_str = w_string::printf( data/watchman-4.9.0/FileDescriptor.cpp:252: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. access |= GENERIC_WRITE; data/watchman-4.9.0/FileDescriptor.cpp:255: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. access |= GENERIC_READ; data/watchman-4.9.0/FileDescriptor.cpp:287:34: [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. CreateFileW(wpath.c_str(), access, share, &sec, create, attrs, nullptr))); data/watchman-4.9.0/Logging.h:72:37: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. w_string::vprintf(fmt, ap)))}, data/watchman-4.9.0/clockspec.cpp:27:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf( data/watchman-4.9.0/clockspec.cpp:42:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(str, "c:%d:%" PRIu32, &pid, &ticks) == 2) { data/watchman-4.9.0/clockspec.cpp:200: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. int res = snprintf(buf, bufsize, "c:%" PRIu64 ":%d:%u:%" PRIu32, data/watchman-4.9.0/listener.cpp:57:30: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. auto errorText = w_string::vprintf(fmt, ap); data/watchman-4.9.0/main.cpp:405: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(plist_path, R_OK) == 0) { data/watchman-4.9.0/stream_win.cpp:108: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, x, __VA_ARGS__); \ data/watchman-4.9.0/stream_win.cpp:727:5: [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. access |= GENERIC_WRITE; data/watchman-4.9.0/stream_win.cpp:730:5: [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. access |= GENERIC_READ; data/watchman-4.9.0/stream_win.cpp:761:34: [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. CreateFileW(wpath.c_str(), access, share, &sec, create, attrs, nullptr))); data/watchman-4.9.0/string.cpp:486:20: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. w_string w_string::vprintf(const char* format, va_list args) { data/watchman-4.9.0/string.cpp:494:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. len = vsnprintf(nullptr, 0, format, args_copy); data/watchman-4.9.0/string.cpp:508:3: [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. vsnprintf(buf, len + 1, format, args); data/watchman-4.9.0/string.cpp:514:20: [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. w_string w_string::printf(WATCHMAN_FMT_STRING(const char* format), ...) { data/watchman-4.9.0/string.cpp:517:24: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. auto res = w_string::vprintf(format, args); data/watchman-4.9.0/tests/integration/cppclient.cpp:25:3: [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. system("rm -f hit"); data/watchman-4.9.0/tests/integration/cppclient.cpp:75:3: [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. system("touch hit"); data/watchman-4.9.0/tests/integration/cppclient.cpp:88:3: [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. system("rm hit"); data/watchman-4.9.0/tests/string_test.cpp:85:3: [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( data/watchman-4.9.0/thirdparty/jansson/dump.cpp:180: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. size = snprintf(buffer, MAX_INTEGER_STR_LENGTH, data/watchman-4.9.0/thirdparty/jansson/error.cpp:35: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(error->source, source); data/watchman-4.9.0/thirdparty/jansson/error.cpp:39: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(error->source + 3, source + extra); data/watchman-4.9.0/thirdparty/jansson/error.cpp:68:5: [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. vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); data/watchman-4.9.0/thirdparty/jansson/jansson_private.h:95: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. #define snprintf _snprintf data/watchman-4.9.0/thirdparty/jansson/jansson_private.h:95:18: [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 snprintf _snprintf data/watchman-4.9.0/thirdparty/jansson/jansson_private.h:96:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define vsnprintf _vsnprintf data/watchman-4.9.0/thirdparty/jansson/load.cpp:91:5: [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. vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap); data/watchman-4.9.0/thirdparty/jansson/memory.cpp:43: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(new_str, str); data/watchman-4.9.0/thirdparty/tap.cpp:279:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stdout, fmt, ap); data/watchman-4.9.0/watchman.h:49:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access(path, F_OK) == 0; data/watchman-4.9.0/watchman_string.h:332:19: [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. static w_string printf(WATCHMAN_FMT_STRING(const char* format), ...) data/watchman-4.9.0/watchman_string.h:334:19: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. static w_string vprintf(const char* format, va_list ap); data/watchman-4.9.0/winbuild/config.h:63: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. #define snprintf _snprintf data/watchman-4.9.0/winbuild/config.h:63:18: [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 snprintf _snprintf data/watchman-4.9.0/cfg.cpp:28: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 *cfg_file = getenv("WATCHMAN_CONFIG_FILE"); data/watchman-4.9.0/cppclient/WatchmanConnection.cpp:53: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. auto var = getenv("WATCHMAN_SOCK"); data/watchman-4.9.0/main.cpp:470: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. getenv("PATH"), data/watchman-4.9.0/main.cpp:530:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. val = getenv(name1); data/watchman-4.9.0/main.cpp:532: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. val = getenv(name2); data/watchman-4.9.0/main.cpp:1022:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TMUX")) { data/watchman-4.9.0/opt.cpp:157:17: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((res = getopt_long(argc, argv, shortopts, data/watchman-4.9.0/stream_win.cpp:188:8: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((getenv("WATCHMAN_WIN7_COMPAT") && data/watchman-4.9.0/stream_win.cpp:189:8: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. getenv("WATCHMAN_WIN7_COMPAT")[0] == '1') || !func) { data/watchman-4.9.0/stream_win.cpp:199:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&mtx); data/watchman-4.9.0/stream_win.cpp:258:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&h->mtx); data/watchman-4.9.0/stream_win.cpp:276:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&h->mtx); data/watchman-4.9.0/stream_win.cpp:436:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&h->mtx); data/watchman-4.9.0/stream_win.cpp:517:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&mtx); data/watchman-4.9.0/stream_win.cpp:610:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&mtx); data/watchman-4.9.0/thirdparty/tap.cpp:146:6: [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("HARNESS_ACTIVE") != NULL) data/watchman-4.9.0/thirdparty/tap.cpp:272:8: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!getenv("TAP_SHOW_DIAG")) { data/watchman-4.9.0/watcher/eden.cpp:63: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. auto path = folly::to<std::string>(getenv("HOME"), "/local/.eden/socket"); data/watchman-4.9.0/winbuild/config.h:73:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char *realpath(const char *filename, char *target); data/watchman-4.9.0/winbuild/dir.cpp:39:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("WATCHMAN_WIN7_COMPAT") && data/watchman-4.9.0/winbuild/dir.cpp:40:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. getenv("WATCHMAN_WIN7_COMPAT")[0] == '1') { data/watchman-4.9.0/winbuild/getopt.h:30:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long(int argc, char *const argv[], data/watchman-4.9.0/winbuild/getopt.h:34:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(int nargc, char * const nargv[], const char *ostr); data/watchman-4.9.0/winbuild/getopt_long.cpp:51:1: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt_long(int argc, char *const argv[], data/watchman-4.9.0/ChildProcess.cpp:82: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(buf, key.data(), key.size()); data/watchman-4.9.0/ChildProcess.cpp:85: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(buf, "=", 1); data/watchman-4.9.0/ChildProcess.cpp:88: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(buf, val.data(), val.size()); data/watchman-4.9.0/ChildProcess.cpp:195: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). void ChildProcess::Options::open( data/watchman-4.9.0/ChildProcess.cpp:238:3: [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). open(STDIN_FILENO, "NUL", O_RDONLY, 0); data/watchman-4.9.0/ChildProcess.cpp:240:3: [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). open(STDIN_FILENO, "/dev/null", O_RDONLY, 0); data/watchman-4.9.0/ChildProcess.cpp:281: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 savedCwd[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/ChildProcess.cpp:488: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[BUFSIZ]; data/watchman-4.9.0/ChildProcess.cpp:590: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/watchman-4.9.0/ChildProcess.h:93: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). void open(int targetFd, const char* path, int flags, int mode); data/watchman-4.9.0/CookieSync.cpp: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 hostname[256]; data/watchman-4.9.0/FileDescriptor.cpp:158: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 canonical_name[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/FileDescriptor.cpp:230: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). auto fd = open(path, flags); data/watchman-4.9.0/FileDescriptor.cpp:370: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[MAXPATHLEN + 1]; data/watchman-4.9.0/FileDescriptor.cpp:377: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 procpath[1024]; data/watchman-4.9.0/FileDescriptor.cpp:382: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[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/InMemoryView.cpp:588: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 clockbuf[128]; data/watchman-4.9.0/Logging.h:39: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 timebuf[64]; data/watchman-4.9.0/Logging.h:63: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 timebuf[64]; data/watchman-4.9.0/bser.cpp:594: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 keybuf[128]; data/watchman-4.9.0/bser.cpp:631: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(keybuf, start, (size_t)slen); data/watchman-4.9.0/clockspec.cpp:210: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 clockbuf[128]; data/watchman-4.9.0/cmds/reg.cpp:54: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 capname[128]; data/watchman-4.9.0/cmds/reg.cpp:139: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 sample_name[128]; data/watchman-4.9.0/expflags.cpp:27: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(buf, fmap->label, space); data/watchman-4.9.0/json.cpp:546: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(jr->buf + jr->wpos, buffer, room); data/watchman-4.9.0/listener.cpp:362: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(un.sun_path, path, strlen(path) + 1); data/watchman-4.9.0/log.cpp:107: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 timebuf[64]; data/watchman-4.9.0/log.cpp:269: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 timebuf[64]; data/watchman-4.9.0/main.cpp:67: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(pid_file, O_RDWR | O_CREAT, 0644)); data/watchman-4.9.0/main.cpp:78: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 pidstr[32]; data/watchman-4.9.0/main.cpp:126:8: [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("/dev/null", O_RDONLY); data/watchman-4.9.0/main.cpp:131:8: [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(log_name, O_WRONLY|O_APPEND|O_CREAT, 0600); data/watchman-4.9.0/main.cpp:149: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 hostname[256]; data/watchman-4.9.0/main.cpp:267: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 module_name[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/main.cpp:272:8: [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). opts.open(STDIN_FILENO, "/dev/null", O_RDONLY, 0666); data/watchman-4.9.0/main.cpp:273:8: [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). opts.open(STDOUT_FILENO, log_name, O_WRONLY | O_CREAT | O_APPEND, 0600); data/watchman-4.9.0/main.cpp:307:8: [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). opts.open(STDIN_FILENO, "/dev/null", O_RDONLY, 0666); data/watchman-4.9.0/main.cpp:308:8: [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). opts.open(STDOUT_FILENO, log_name, O_WRONLY | O_CREAT | O_APPEND, 0600); data/watchman-4.9.0/main.cpp:333:8: [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). opts.open(STDIN_FILENO, "/dev/null", O_RDONLY, 0666); data/watchman-4.9.0/main.cpp:334:8: [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). opts.open(STDOUT_FILENO, log_name, O_WRONLY | O_CREAT | O_APPEND, 0600); data/watchman-4.9.0/main.cpp:375: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 watchman_path[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/main.cpp:377: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 plist_path[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/main.cpp:418:8: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(plist_path, "w"); data/watchman-4.9.0/main.cpp:698: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 user_buf[256]; data/watchman-4.9.0/main.cpp:760: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(un.sun_path, sock_name, strlen(sock_name) + 1); data/watchman-4.9.0/opendir.cpp:53: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 * (sizeof(bulk_attr_item) + NAME_MAX * 3 + 1)]; data/watchman-4.9.0/opendir.cpp:222: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(&ent_.stat.mtime, &item->mtime, sizeof(item->mtime)); data/watchman-4.9.0/opendir.cpp:223: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(&ent_.stat.ctime, &item->ctime, sizeof(item->ctime)); data/watchman-4.9.0/opendir.cpp:224: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(&ent_.stat.atime, &item->atime, sizeof(item->atime)); data/watchman-4.9.0/opt.cpp:46: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[80]; data/watchman-4.9.0/opt.cpp:209:40: [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). auto ival = json_integer(atoi(optarg)); data/watchman-4.9.0/pending.cpp:239: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_label[128]; data/watchman-4.9.0/perf.cpp:198: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). opts.open(STDIN_FILENO, "/dev/null", O_RDONLY, 0666); data/watchman-4.9.0/perf.cpp:199: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). opts.open(STDOUT_FILENO, "/dev/null", O_WRONLY, 0666); data/watchman-4.9.0/perf.cpp:200: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). opts.open(STDERR_FILENO, "/dev/null", O_WRONLY, 0666); data/watchman-4.9.0/python/pywatchman/bser.c:278: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(bser->buf + bser->wpos, data, len); data/watchman-4.9.0/python/pywatchman/bser.c:545: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(bser.buf + 3, &len, sizeof(len)); data/watchman-4.9.0/python/pywatchman/bser.c:549: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(bser.buf + 2, &bser_capabilities, sizeof(bser_capabilities)); data/watchman-4.9.0/python/pywatchman/bser.c:550: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(bser.buf + 7, &len, sizeof(len)); data/watchman-4.9.0/query/fieldlist.cpp:30: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/watchman-4.9.0/query/fieldlist.cpp:58: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/watchman-4.9.0/query/fieldlist.cpp:204: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 capname[128]; data/watchman-4.9.0/query/parse.cpp:21: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 capname[128]; data/watchman-4.9.0/root/crawler.cpp:29: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[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/root/crawler.cpp:44: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, dir_name.data(), dir_name.size()); data/watchman-4.9.0/root/file.cpp:99: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(data, name.data(), name.size()); data/watchman-4.9.0/root/init.cpp:10: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 cfgfilename[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/root/stat.cpp: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 path[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/root/stat.cpp:40: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, full_path.data(), full_path.size()); data/watchman-4.9.0/root/watchlist.cpp:62: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(prefix, filename, root->root_path.size()); data/watchman-4.9.0/ruby/ruby-watchman/ext/ruby-watchman/watchman.c:94: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(w->data + w->len, data, len); data/watchman-4.9.0/ruby/ruby-watchman/ext/ruby-watchman/watchman.c:127: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 encoded[1 + sizeof(int64_t)]; data/watchman-4.9.0/ruby/ruby-watchman/ext/ruby-watchman/watchman.c:161: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 encoded[1 + sizeof(double)]; data/watchman-4.9.0/spawn.cpp:16: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 stdin_file_name[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/spawn.cpp:192: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). opts.open(STDOUT_FILENO, cmd->stdout_name, cmd->stdout_flags, 0666); data/watchman-4.9.0/spawn.cpp:198: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). opts.open(STDOUT_FILENO, cmd->stderr_name, cmd->stderr_flags, 0666); data/watchman-4.9.0/state.cpp:118:23: [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). fd = FileDescriptor(mkstemp(templ)); data/watchman-4.9.0/stream_unix.cpp:38: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[64]; data/watchman-4.9.0/stream_unix.cpp:243: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(un.sun_path, path, strlen(path)); data/watchman-4.9.0/stream_unix.cpp:277:38: [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 w_stm_fdopen(FileDescriptor(open(filename, flags, mode))); data/watchman-4.9.0/stream_win.cpp:55: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[1]; data/watchman-4.9.0/stream_win.cpp:68: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 read_buf[8192]; data/watchman-4.9.0/stream_win.cpp:102: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 timebuf[64]; \ data/watchman-4.9.0/stream_win.cpp: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(*target_buf_ptr, h->read_cursor, nread); data/watchman-4.9.0/stream_win.cpp:543: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(wbuf->data, buf, size); data/watchman-4.9.0/string.cpp:363: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(buf, p.data(), p.size()); data/watchman-4.9.0/string.cpp:464: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(buf, str, len); data/watchman-4.9.0/string.cpp:691: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 name_buf[128]; data/watchman-4.9.0/string.cpp:894: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(buf, parent->buf, parent->len); data/watchman-4.9.0/string.cpp:896: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(buf + parent->len + 1, rhs->buf, rhs->len); data/watchman-4.9.0/string.cpp:927: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(buf, parent->buf, parent->len); data/watchman-4.9.0/string.cpp:929: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(buf + parent->len + 1, rhs, rhs_len); data/watchman-4.9.0/string.cpp:963: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(end, extra.data(), extra.size()); data/watchman-4.9.0/string.cpp:971: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(end, d->name.data(), d->name.size()); data/watchman-4.9.0/string.cpp:987: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(buf, str->buf, str->len); data/watchman-4.9.0/string.cpp:1017: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(buf, "'\\''", 4); data/watchman-4.9.0/tests/art_test.cpp:23:13: [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 *f = fopen(name, "r"); data/watchman-4.9.0/tests/art_test.cpp:24: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 altname[1024]; data/watchman-4.9.0/tests/art_test.cpp:31:7: [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(altname, "r"); data/watchman-4.9.0/tests/art_test.cpp:42: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/watchman-4.9.0/tests/art_test.cpp:60: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 key1[300] = { data/watchman-4.9.0/tests/art_test.cpp:83: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 key2[303] = { data/watchman-4.9.0/tests/art_test.cpp:115: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/watchman-4.9.0/tests/art_test.cpp:156: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/watchman-4.9.0/tests/art_test.cpp:207: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/watchman-4.9.0/tests/art_test.cpp:376: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/watchman-4.9.0/tests/ignore_test.cpp:105: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/watchman-4.9.0/tests/ignore_test.cpp:106:13: [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 *f = fopen("thirdparty/libart/tests/words.txt", "r"); data/watchman-4.9.0/tests/ignore_test.cpp:109: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("watchman/thirdparty/libart/tests/words.txt", "r"); data/watchman-4.9.0/tests/integration/cppclient.cpp:50: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_dir[PATH_MAX]; data/watchman-4.9.0/tests/log.cpp:11: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 huge[8192]; data/watchman-4.9.0/tests/string_test.cpp:82: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 lowerBuf[20]; data/watchman-4.9.0/tests/string_test.cpp:112:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[16]; data/watchman-4.9.0/tests/wildmatch_test.cpp:64:21: [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). test_cases_file = fopen(WILDMATCH_TEST_JSON_FILE, "r"); data/watchman-4.9.0/tests/wildmatch_test.cpp:66:23: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). test_cases_file = fopen("watchman/" WILDMATCH_TEST_JSON_FILE, "r"); data/watchman-4.9.0/thirdparty/jansson/dump.cpp:81: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 seq[13]; data/watchman-4.9.0/thirdparty/jansson/dump.cpp:131:21: [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(seq, "\\u%04x", codepoint); data/watchman-4.9.0/thirdparty/jansson/dump.cpp:144:21: [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(seq, "\\u%04x\\u%04x", first, last); data/watchman-4.9.0/thirdparty/jansson/dump.cpp:177: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 buffer[MAX_INTEGER_STR_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/dump.cpp:192: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 buffer[MAX_REAL_STR_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/dump.cpp:365:20: [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 *output = fopen(path, "w"); data/watchman-4.9.0/thirdparty/jansson/error.cpp:38:9: [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(error->source, "..."); data/watchman-4.9.0/thirdparty/jansson/jansson.h:205: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 source[JSON_ERROR_SOURCE_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/jansson.h:206: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 text[JSON_ERROR_TEXT_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/jansson_private.h:27:24: [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 va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) data/watchman-4.9.0/thirdparty/jansson/load.cpp:52: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[5]; data/watchman-4.9.0/thirdparty/jansson/load.cpp: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 msg_text[JSON_ERROR_TEXT_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/load.cpp: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 msg_with_context[JSON_ERROR_TEXT_LENGTH]; data/watchman-4.9.0/thirdparty/jansson/load.cpp:374: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 buffer[4]; data/watchman-4.9.0/thirdparty/jansson/load.cpp:422: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(t, buffer, length); data/watchman-4.9.0/thirdparty/jansson/load.cpp:973: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). fp = fopen(path, "rb"); data/watchman-4.9.0/thirdparty/jansson/load.cpp:991: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[MAX_BUF_LEN]; data/watchman-4.9.0/thirdparty/jansson/strbuffer.cpp:90: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_value, strbuff->value, strbuff->length); data/watchman-4.9.0/thirdparty/jansson/strbuffer.cpp:97: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(strbuff->value + strbuff->length, data, size); data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:99: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(partial, other.partial, std::min(ART_MAX_PREFIX_LEN, partial_len)); data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:112: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(keys, n16.keys, n16.num_children * sizeof(keys[0])); data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:197: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(this->partial + prefix, child->partial, sub_prefix); data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:202: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( data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:228: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(keys, n4.keys, this->num_children * sizeof(keys[0])); data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:861: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( data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:896: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( data/watchman-4.9.0/thirdparty/libart/src/art-inl.h:915: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( data/watchman-4.9.0/thirdparty/libart/src/art.h:36: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 partial[ART_MAX_PREFIX_LEN]; data/watchman-4.9.0/thirdparty/libart/src/art.h:111: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 keys[4]; data/watchman-4.9.0/thirdparty/libart/src/art.h:125: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 keys[16]; data/watchman-4.9.0/thirdparty/libart/src/art.h:141: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 keys[256]; data/watchman-4.9.0/watcher/fsevents.cpp:510: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_label[128]; data/watchman-4.9.0/watcher/inotify.cpp: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 ibuf data/watchman-4.9.0/watcher/inotify.cpp: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 flags_label[128]; data/watchman-4.9.0/watcher/inotify.cpp:173: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[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/watcher/kqueue.cpp:86:27: [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 fdHolder(open(full_name.c_str(), O_EVTONLY | O_CLOEXEC)); data/watchman-4.9.0/watcher/kqueue.cpp:147:27: [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 fdHolder(open(path, O_NOFOLLOW | O_EVTONLY | O_CLOEXEC)); data/watchman-4.9.0/watcher/kqueue.cpp:235: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 flags_label[128]; data/watchman-4.9.0/watchman_string.h:447: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(buf, src, amount); data/watchman-4.9.0/watchman_string.h:454: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 localBuf[20]; data/watchman-4.9.0/watchman_string.h:469: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 localBuf[16]; data/watchman-4.9.0/winbuild/asprintf.cpp:9: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 stack[512]; data/watchman-4.9.0/winbuild/backtrace.cpp:34: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[kMaxSymbolLen]; data/watchman-4.9.0/winbuild/backtrace.cpp:50: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[kMaxSymbolLen + 128]; data/watchman-4.9.0/winbuild/backtrace.cpp:84: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(buf, arr[i].c_str(), arr[i].size() + 1); data/watchman-4.9.0/winbuild/dir.cpp: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 __declspec(align(8)) buf_[64 * 1024]; data/watchman-4.9.0/winbuild/dir.cpp:21: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 nameBuf_[WATCHMAN_NAME_MAX]; data/watchman-4.9.0/winbuild/errmap.cpp:7:29: [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 __declspec(thread) char msgbuf[1024]; data/watchman-4.9.0/winbuild/pathmap.cpp:136:9: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). len = MultiByteToWideChar(CP_UTF8, 0, path.data(), path.size(), nullptr, 0); data/watchman-4.9.0/winbuild/pathmap.cpp:161:9: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). res = MultiByteToWideChar( data/watchman-4.9.0/winbuild/posix_spawn.cpp:192:11: [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(cur, "\"\"\""); data/watchman-4.9.0/winbuild/posix_spawn.cpp:229: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(target, envp[i], len + 1); data/watchman-4.9.0/winbuild/susres.cpp:15: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 msgbuf[1024]; data/watchman-4.9.0/ChildProcess.cpp:217:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). pipe->read.clearNonBlock(); data/watchman-4.9.0/ChildProcess.cpp:221:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). dup2(childRead ? pipe->read : pipe->write, targetFd); data/watchman-4.9.0/ChildProcess.cpp:334:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). it.second->read.close(); data/watchman-4.9.0/ChildProcess.cpp:452:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). pfd.fd = it.second->read.fd(); data/watchman-4.9.0/ChildProcess.cpp:489:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto l = ::read(pfd.fd, buf, sizeof(buf)); data/watchman-4.9.0/ChildProcess.cpp:591:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto readResult = pipe->read.read(buf, sizeof(buf)); data/watchman-4.9.0/ChildProcess.cpp:591:38: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto readResult = pipe->read.read(buf, sizeof(buf)); data/watchman-4.9.0/ContentHash.cpp:68:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto n = stm->read(buf, sizeof(buf)); data/watchman-4.9.0/ContentHash.cpp:110:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto n = stm->read(buf, sizeof(buf)); data/watchman-4.9.0/FileDescriptor.cpp:695:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Result<int, std::error_code> FileDescriptor::read(void* buf, int size) const { data/watchman-4.9.0/FileDescriptor.cpp:697:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto result = ::read(fd_, buf, size); data/watchman-4.9.0/FileDescriptor.h:120:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Result<int, std::error_code> read(void* buf, int size) const; data/watchman-4.9.0/Pipe.cpp:47:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read.setCloExec(); data/watchman-4.9.0/Pipe.cpp:48:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read.setNonBlock(); data/watchman-4.9.0/Pipe.h:11:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). FileDescriptor read; data/watchman-4.9.0/cmds/watch.cpp:155: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(candidate_dir) == 3 && candidate_dir[1] == ':' && data/watchman-4.9.0/cmds/watch.cpp:160: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(candidate_dir) <= 2) { data/watchman-4.9.0/expflags.cpp:26: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). space = std::min(len, strlen(fmap->label) + 1); data/watchman-4.9.0/fstype.cpp:88:29: [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). return w_string(fstype, wcslen(fstype)); data/watchman-4.9.0/json.cpp:63:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = stm->read(buf + wpos, avail); data/watchman-4.9.0/json.cpp:231:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = stm->read(buf + wpos, allocd - wpos); data/watchman-4.9.0/json.cpp:393:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = stm->read(buf + wpos, avail); data/watchman-4.9.0/listener.cpp:353:7: [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(path) >= sizeof(un.sun_path) - 1) { data/watchman-4.9.0/listener.cpp:362: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). memcpy(un.sun_path, path, strlen(path) + 1); data/watchman-4.9.0/listener.cpp:713:7: [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(interval); data/watchman-4.9.0/main.cpp:81:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fd.fd(), pidstr, sizeof(pidstr) - 1); data/watchman-4.9.0/main.cpp:753:7: [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(sock_name) >= sizeof(un.sun_path) - 1) { data/watchman-4.9.0/main.cpp:760: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). memcpy(un.sun_path, sock_name, strlen(sock_name) + 1); data/watchman-4.9.0/opendir.cpp:67: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 char *last = path + strlen(path) - 1; data/watchman-4.9.0/opt.cpp:24: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). len = strlen(opts[i].optname); data/watchman-4.9.0/opt.cpp:27: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). len += strlen(label) + strlen("="); data/watchman-4.9.0/opt.cpp:27: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). len += strlen(label) + strlen("="); data/watchman-4.9.0/opt.cpp:34: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). len += strlen("-X, "); data/watchman-4.9.0/query/type.cpp:50: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). if (!found || strlen(typestr) > 1) { data/watchman-4.9.0/root/watchlist.cpp:279:5: [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(interval); data/watchman-4.9.0/spawn.cpp:156: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). argspace_remaining -= strlen(ele) + 1 + sizeof(char*); data/watchman-4.9.0/state.cpp:107:28: [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. /* sleep override */ usleep(2000); data/watchman-4.9.0/stream_stdout.cpp:14:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(void* buf, int size) override { data/watchman-4.9.0/stream_stdout.cpp:15:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto result = fd_.read(buf, size); data/watchman-4.9.0/stream_unix.cpp:40:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(pipe.read.fd(), buf, sizeof(buf)) > 0) { data/watchman-4.9.0/stream_unix.cpp:40:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(pipe.read.fd(), buf, sizeof(buf)) > 0) { data/watchman-4.9.0/stream_unix.cpp:47:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return pipe.read.fd(); data/watchman-4.9.0/stream_unix.cpp:95:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(void* buf, int size) override { data/watchman-4.9.0/stream_unix.cpp:97:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return ::read(fd.fd(), buf, size); data/watchman-4.9.0/stream_unix.cpp:230:7: [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(path) >= sizeof(un.sun_path) - 1) { data/watchman-4.9.0/stream_unix.cpp:243: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). memcpy(un.sun_path, path, strlen(path)); data/watchman-4.9.0/stream_unix.cpp:252:9: [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(10000); data/watchman-4.9.0/stream_win.cpp:75:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(void* buf, int size) override; data/watchman-4.9.0/stream_win.cpp:399:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int win_handle::read(void* buf, int size) { data/watchman-4.9.0/stream_win.cpp:627:7: [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(path) > 255) { data/watchman-4.9.0/string.cpp:430:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t slen = strlen(str); data/watchman-4.9.0/string.cpp:851:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). base = path + strlen(path); data/watchman-4.9.0/tests/art_test.cpp:47: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:120: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:132: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:161: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:176: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:213: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:381: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). len = (int)strlen(buf); data/watchman-4.9.0/tests/art_test.cpp:394: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). len = (int)strlen(buf); data/watchman-4.9.0/thirdparty/jansson/error.cpp:33: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). length = strlen(source); data/watchman-4.9.0/thirdparty/jansson/load.cpp:953:33: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(lex_init(&lex, (get_func)fgetc, input)) data/watchman-4.9.0/thirdparty/jansson/memory.cpp:39: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). new_str = (char*)jsonp_malloc(strlen(str) + 1); data/watchman-4.9.0/thirdparty/jansson/strbuffer.cpp:62:52: [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 strbuffer_append_bytes(strbuff, string, strlen(string)); data/watchman-4.9.0/thirdparty/jansson/utf.cpp:145: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). length = strlen(string); data/watchman-4.9.0/timedlock.cpp:30:28: [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. /* sleep override */ usleep(usec); \ data/watchman-4.9.0/watcher/fsevents.cpp:236: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). len = strlen(path); data/watchman-4.9.0/watcher/fsevents.cpp:457:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nullptr, fse_pipe.read.fd(), true, fse_pipe_callback, &fdctx); data/watchman-4.9.0/watcher/inotify.cpp:318:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(infd.fd(), &ibuf, sizeof(ibuf)); data/watchman-4.9.0/watcher/inotify.cpp:377:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). pfd[1].fd = terminatePipe_.read.fd(); data/watchman-4.9.0/watcher/kqueue.cpp:292:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). pfd[1].fd = terminatePipe_.read.fd(); data/watchman-4.9.0/watchman_stream.h:23:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual int read(void* buf, int size) = 0; data/watchman-4.9.0/watchman_string.h:167: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). : s_(cstr), e_(cstr + strlen(cstr)) {} data/watchman-4.9.0/watchman_system.h:121:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #pragma section(".CRT$XCU", read) data/watchman-4.9.0/winbuild/getopt_long.cpp:94:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(longopts[i].name) == namelen data/watchman-4.9.0/winbuild/posix_spawn.cpp:162: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 += 4 * (strlen(argv[argc]) + 1); data/watchman-4.9.0/winbuild/posix_spawn.cpp:174: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). cur = cmdbuf + strlen(CMD_EXE_PREFIX); data/watchman-4.9.0/winbuild/posix_spawn.cpp:216: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). total_len += strlen(envp[i]) + 1; data/watchman-4.9.0/winbuild/posix_spawn.cpp:227: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(envp[i]); data/watchman-4.9.0/winbuild/sys/time.h:23:6: [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. void usleep(int64_t usec); data/watchman-4.9.0/winbuild/time.cpp:45:6: [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. void usleep(int64_t usec) { ANALYSIS SUMMARY: Hits = 319 Lines analyzed = 41972 in approximately 1.00 seconds (41991 lines/second) Physical Source Lines of Code (SLOC) = 30252 Hits@level = [0] 108 [1] 81 [2] 169 [3] 24 [4] 38 [5] 7 Hits@level+ = [0+] 427 [1+] 319 [2+] 238 [3+] 69 [4+] 45 [5+] 7 Hits/KSLOC@level+ = [0+] 14.1148 [1+] 10.5448 [2+] 7.86725 [3+] 2.28084 [4+] 1.4875 [5+] 0.23139 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.