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/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor_factory.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/event.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/poll_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/path_utils.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/fen_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/kqueue_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/libfswatch_exception.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/fsevents_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/inotify_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/libfswatch_map.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/filter.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/fsevents_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/inotify_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/libfswatch_set.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/filter.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/string/string_utils.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/string/string_utils.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor_factory.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/event.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/poll_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_handle.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_error_message.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_strings.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_paths.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_directory_change_event.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_strings.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_paths.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_directory_change_event.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_handle.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_error_message.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/path_utils.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/fen_monitor.hpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/kqueue_monitor.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/libfswatch_exception.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext_defs.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/error.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch_types.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch_log.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/cfilter.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch.cpp Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/cmonitor.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/cevent.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch_log.h Examining data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/cevent.cpp Examining data/fswatch-1.14.0+repack/fswatch/src/fswatch.hpp Examining data/fswatch-1.14.0+repack/fswatch/src/fswatch.cpp Examining data/fswatch-1.14.0+repack/fswatch/src/gettext.h FINAL RESULTS: data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor.cpp:174:39: [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. void monitor::set_watch_access(bool access) data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor.cpp:176:20: [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. watch_access = access; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/monitor.hpp:431:32: [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. void set_watch_access(bool access); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/string/string_utils.cpp:38:26: [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. required_chars = vsnprintf(&buffer[0], current_buffer_size, format, args); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/cevent.cpp:69:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(cstr, name.c_str()); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch_log.cpp:41:3: [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, format, args); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch_log.cpp:53:3: [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(f, format, args); data/fswatch-1.14.0+repack/fswatch/src/fswatch.cpp:541:16: [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 ((ch = getopt_long(argc, data/fswatch-1.14.0+repack/fswatch/src/fswatch.cpp:548:18: [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. while ((ch = getopt(argc, argv, short_options.c_str())) != -1) data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/path_utils.cpp:68:17: [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 *ret = realpath(path, resolved_path); data/fswatch-1.14.0+repack/fswatch/src/fswatch.cpp:342: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 time_format_buffer[TIME_FORMAT_BUFF_SIZE]; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:218:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char msg_ctxt_id[msgctxt_len + msgid_len]; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:220:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:229: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/fswatch-1.14.0+repack/fswatch/src/gettext.h:231: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/fswatch-1.14.0+repack/fswatch/src/gettext.h:266: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:268:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:277: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/fswatch-1.14.0+repack/fswatch/src/gettext.h:279: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/fsevents_monitor.cpp:212: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. events.emplace_back(((char **) eventPaths)[i], data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/inotify_monitor.cpp:382: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[BUFFER_SIZE]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/kqueue_monitor.cpp:164:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(path.c_str(), o_flags); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/windows/win_strings.cpp:28:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[buf_size]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:218:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char msg_ctxt_id[msgctxt_len + msgid_len]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:220:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:229: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:231: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:266: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:268:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:277: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:279: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/fswatch-1.14.0+repack/fswatch/src/gettext.h:214:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgctxt_len = strlen (msgctxt) + 1; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:215:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgid_len = strlen (msgid) + 1; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:262:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgctxt_len = strlen (msgctxt) + 1; data/fswatch-1.14.0+repack/fswatch/src/gettext.h:263:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgid_len = strlen (msgid) + 1; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c++/inotify_monitor.cpp:431:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t record_num = read(impl->inotify_monitor_handle, data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/c/libfswatch.cpp:519:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cevt->path, path.c_str(), path.length()); data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:214:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgctxt_len = strlen (msgctxt) + 1; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:215:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgid_len = strlen (msgid) + 1; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:262:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgctxt_len = strlen (msgctxt) + 1; data/fswatch-1.14.0+repack/libfswatch/src/libfswatch/gettext.h:263:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t msgid_len = strlen (msgid) + 1; ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 9023 in approximately 0.25 seconds (35462 lines/second) Physical Source Lines of Code (SLOC) = 4774 Hits@level = [0] 3 [1] 10 [2] 21 [3] 3 [4] 7 [5] 0 Hits@level+ = [0+] 44 [1+] 41 [2+] 31 [3+] 10 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 9.21659 [1+] 8.58819 [2+] 6.49351 [3+] 2.09468 [4+] 1.46628 [5+] 0 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.