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/inotify-tools-3.14/src/inotifywatch.c Examining data/inotify-tools-3.14/src/common.h Examining data/inotify-tools-3.14/src/common.c Examining data/inotify-tools-3.14/src/inotifywait.c Examining data/inotify-tools-3.14/libinotifytools/src/inotifytools_p.h Examining data/inotify-tools-3.14/libinotifytools/src/redblack.h Examining data/inotify-tools-3.14/libinotifytools/src/redblack.c Examining data/inotify-tools-3.14/libinotifytools/src/example.c Examining data/inotify-tools-3.14/libinotifytools/src/inotifytools/inotifytools.h Examining data/inotify-tools-3.14/libinotifytools/src/inotifytools/inotify-nosys.h Examining data/inotify-tools-3.14/libinotifytools/src/test.c Examining data/inotify-tools-3.14/libinotifytools/src/inotifytools.c FINAL RESULTS: data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:663:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:667:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:671:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:675:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:679:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:683:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:687:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:691:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:695:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:699:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:703:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:707:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:711:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:715:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:719:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:723:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:727:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:731:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat( ret, chrtostr(sep) ); data/inotify-tools-3.14/libinotifytools/src/test.c:37:2: [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, __VA_ARGS__);\ data/inotify-tools-3.14/libinotifytools/src/test.c:49:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(__VA_ARGS__); \ data/inotify-tools-3.14/libinotifytools/src/test.c:281:11: [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. compare( system("rm -rf " TEST_DIR), 0 ); data/inotify-tools-3.14/src/inotifywait.c:45:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. bool * syslog, data/inotify-tools-3.14/src/inotifywait.c:72: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( csv, string ); data/inotify-tools-3.14/src/inotifywait.c:131:25: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. void output_error( bool syslog, char* fmt, ... ) { data/inotify-tools-3.14/src/inotifywait.c:134:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. if ( syslog ) { data/inotify-tools-3.14/src/inotifywait.c:137: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(stderr, fmt, va); data/inotify-tools-3.14/src/inotifywait.c:165:47: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. &recursive, &csv, &daemon, &syslog, &format, &timefmt, data/inotify-tools-3.14/src/inotifywait.c:277:14: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. if ( syslog ) { data/inotify-tools-3.14/src/inotifywait.c:283:18: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Setting up watches. Beware: since -r " data/inotify-tools-3.14/src/inotifywait.c:286:18: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Setting up watches.\n" ); data/inotify-tools-3.14/src/inotifywait.c:299:19: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Failed to watch %s; upper limit on inotify " data/inotify-tools-3.14/src/inotifywait.c:301:19: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Please increase the amount of inotify watches " data/inotify-tools-3.14/src/inotifywait.c:306:19: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Couldn't watch %s: %s\n", this_file, data/inotify-tools-3.14/src/inotifywait.c:314:17: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Watches established.\n" ); data/inotify-tools-3.14/src/inotifywait.c:328:19: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "%s\n", strerror( inotifytools_error() ) ); data/inotify-tools-3.14/src/inotifywait.c:349:19: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Error removing watch on %s: %s\n", data/inotify-tools-3.14/src/inotifywait.c:368:20: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. output_error( syslog, "Couldn't watch new directory %s: %s\n", data/inotify-tools-3.14/src/inotifywait.c:420:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. bool * syslog, data/inotify-tools-3.14/src/inotifywait.c:430:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. assert( syslog ); assert( format ); assert( timefmt ); assert( fromfile ); data/inotify-tools-3.14/src/inotifywait.c:568:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. (*syslog) = true; data/inotify-tools-3.14/src/inotifywait.c:573:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. (*syslog) = true; data/inotify-tools-3.14/src/inotifywait.c:587: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( newlineformat, optarg ); data/inotify-tools-3.14/libinotifytools/src/test.c:290:22: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *mtrace_name = getenv("MALLOC_TRACE"); data/inotify-tools-3.14/src/inotifywait.c:530:18: [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. char curr_opt = getopt_long(*argc, *argv, opt_string, long_opts, NULL); data/inotify-tools-3.14/src/inotifywait.c:660:14: [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. curr_opt = getopt_long(*argc, *argv, opt_string, long_opts, NULL); data/inotify-tools-3.14/src/inotifywatch.c:470:18: [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. char curr_opt = getopt_long(*argc, *argv, opt_string, long_opts, NULL); data/inotify-tools-3.14/src/inotifywatch.c:609:14: [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. curr_opt = getopt_long(*argc, *argv, opt_string, long_opts, NULL); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:219: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. static char str[2] = { '\0', '\0' }; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:228:16: [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 * file = fopen( filename, "r" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:479:2: [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 eventstr[4096]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:658: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. static char ret[1024]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:664:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "ACCESS" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:668:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "MODIFY" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:672:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "ATTRIB" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:676:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "CLOSE_WRITE" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:680:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "CLOSE_NOWRITE" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:684:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "OPEN" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:688:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "MOVED_FROM" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:692:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "MOVED_TO" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:696:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "CREATE" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:700:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "DELETE" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:704:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "DELETE_SELF" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:708:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "UNMOUNT" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:712:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "Q_OVERFLOW" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:716:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "IGNORED" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:720:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "CLOSE" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:724:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "MOVE_SELF" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:728:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "ISDIR" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:732:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat( ret, "ONESHOT" ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:737: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. niceassert( -1 != sprintf( ret, "%c0x%08x", sep, events ), 0 ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:862:2: [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 *names[2+sizeof(int)/sizeof(char*) + 1]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:956: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. static char const * filenames[2]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1105: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. static char match_name[MAX_STRLEN]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1149:4: [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( &event[0], ret, bytes ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1708: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. static char out[MAX_STRLEN+1]; data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1821: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. static char timestr[MAX_STRLEN]; data/inotify-tools-3.14/libinotifytools/src/test.c:197:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[BUFSZ]; data/inotify-tools-3.14/libinotifytools/src/test.c:198:2: [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 event_buf[4096]; data/inotify-tools-3.14/libinotifytools/src/test.c:219:2: [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( test_event->name, "my_great_file" ); data/inotify-tools-3.14/libinotifytools/src/test.c:228: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 expected[1024]; data/inotify-tools-3.14/libinotifytools/src/test.c:229:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char timestr[1024]; data/inotify-tools-3.14/libinotifytools/src/test.c:253: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 fn[1024]; data/inotify-tools-3.14/src/common.c:67: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). file = fopen( filename, "r" ); data/inotify-tools-3.14/src/common.c:77:2: [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[MAXLEN]; data/inotify-tools-3.14/src/inotifywait.c:58: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. static char csv[MAX_STRLEN+1]; data/inotify-tools-3.14/src/inotifywait.c:103:2: [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( event->name, "foo" ); data/inotify-tools-3.14/src/inotifywait.c:104:19: [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 * devnull = fopen( "/dev/null", "a" ); data/inotify-tools-3.14/src/inotifywait.c:241:15: [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/inotify-tools-3.14/src/inotifywait.c:248:15: [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(outfile, O_WRONLY | O_CREAT | O_APPEND, 0600); data/inotify-tools-3.14/src/inotifywait.c:259: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_WRONLY); data/inotify-tools-3.14/src/inotifywait.c:266: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(outfile, O_WRONLY | O_CREAT | O_APPEND, 0600); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:492:10: [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(event1); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:495:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( eventstr, event1, len ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:865:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *((int*)&names[2]) = strlen(oldname); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1001: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). || filenames[i][strlen(filenames[i])-1] == '/') { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1197:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). this_bytes = read(inotify_fd, &event[0] + bytes, data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1303:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( path[strlen(path)-1] != '/' ) { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1342:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). exclude_length = strlen(*exclude_entry); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1346: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). if ( strlen(next_file) == (unsigned)(exclude_length + 1) && data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1835:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( !fmt || 0 == strlen(fmt) ) { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1839: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(fmt) > MAX_STRLEN || size > MAX_STRLEN) { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1845: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). for ( i = 0; i < strlen(fmt) && data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1852: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 ( i == strlen(fmt) - 1 ) { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1868:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( &out[ind], filename, size - ind ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1869:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ind += strlen(filename); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1877:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( &out[ind], eventname, size - ind ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1878:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ind += strlen(eventname); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1886:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( &out[ind], eventstr, size - ind ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1887: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). ind += strlen(eventstr); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1909:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( &out[ind], timestr, size - ind ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1910: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). ind += strlen(timestr); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1916:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( i < strlen(fmt) - 2 && fmt[i+2] == 'e' ) { data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1918:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( &out[ind], eventstr, size - ind ); data/inotify-tools-3.14/libinotifytools/src/inotifytools.c:1919: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). ind += strlen(eventstr); data/inotify-tools-3.14/libinotifytools/src/test.c:220:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). test_event->len = strlen( test_event->name )+1; data/inotify-tools-3.14/src/common.c:79: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 ( name[strlen(name)-1] == '\n') name[strlen(name)-1] = 0; data/inotify-tools-3.14/src/common.c:79:43: [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 ( name[strlen(name)-1] == '\n') name[strlen(name)-1] = 0; data/inotify-tools-3.14/src/common.c:80:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( strlen(name) == 0 ) continue; data/inotify-tools-3.14/src/common.c:81:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( '@' == name[0] && strlen(name) == 1 ) continue; data/inotify-tools-3.14/src/common.c:94:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( strlen(argv[i]) == 0 ) continue; data/inotify-tools-3.14/src/common.c:95:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( '@' == argv[i][0] && strlen(argv[i]) == 1 ) continue; data/inotify-tools-3.14/src/inotifywait.c:61: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(string) > MAX_STRLEN ) { data/inotify-tools-3.14/src/inotifywait.c:65: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(string) == 0 ) { data/inotify-tools-3.14/src/inotifywait.c:71:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). && string[0] != ' ' && string[strlen(string)-1] != ' ' ) { data/inotify-tools-3.14/src/inotifywait.c:79: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). for ( i = 0; i < strlen(string); ++i ) { data/inotify-tools-3.14/src/inotifywait.c:586:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). newlineformat = (char *)malloc(strlen(optarg)+2); data/inotify-tools-3.14/src/inotifywait.c:588:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat( newlineformat, "\n" ); ANALYSIS SUMMARY: Hits = 127 Lines analyzed = 5573 in approximately 0.21 seconds (26785 lines/second) Physical Source Lines of Code (SLOC) = 3603 Hits@level = [0] 178 [1] 36 [2] 44 [3] 5 [4] 42 [5] 0 Hits@level+ = [0+] 305 [1+] 127 [2+] 91 [3+] 47 [4+] 42 [5+] 0 Hits/KSLOC@level+ = [0+] 84.6517 [1+] 35.2484 [2+] 25.2567 [3+] 13.0447 [4+] 11.657 [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.