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/clsync-0.4.5/calc.c Examining data/clsync-0.4.5/calc.h Examining data/clsync-0.4.5/cgroup.c Examining data/clsync-0.4.5/cgroup.h Examining data/clsync-0.4.5/clsync.h Examining data/clsync-0.4.5/cluster.c Examining data/clsync-0.4.5/cluster.h Examining data/clsync-0.4.5/common.h Examining data/clsync-0.4.5/configuration.h Examining data/clsync-0.4.5/control.c Examining data/clsync-0.4.5/control.h Examining data/clsync-0.4.5/ctx.h Examining data/clsync-0.4.5/doc/devel/thread-splitting/benchmark-synchandler.c Examining data/clsync-0.4.5/doc/freebsd/freebsd10-kernel-bsm-queue-patch/patch-security__audit__audit_pipe.c Examining data/clsync-0.4.5/error.c Examining data/clsync-0.4.5/error.h Examining data/clsync-0.4.5/examples/clsync-synchandler-rsyncso.c Examining data/clsync-0.4.5/examples/clsync-synchandler-so.c Examining data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c Examining data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-pdcp.c Examining data/clsync-0.4.5/fileutils.c Examining data/clsync-0.4.5/fileutils.h Examining data/clsync-0.4.5/gencompilerflags.c Examining data/clsync-0.4.5/glibex.c Examining data/clsync-0.4.5/glibex.h Examining data/clsync-0.4.5/indexes.c Examining data/clsync-0.4.5/indexes.h Examining data/clsync-0.4.5/libclsync.c Examining data/clsync-0.4.5/libclsync.h Examining data/clsync-0.4.5/macros.h Examining data/clsync-0.4.5/main.c Examining data/clsync-0.4.5/main.h Examining data/clsync-0.4.5/malloc.c Examining data/clsync-0.4.5/malloc.h Examining data/clsync-0.4.5/mon_bsm.c Examining data/clsync-0.4.5/mon_bsm.h Examining data/clsync-0.4.5/mon_dtracepipe.c Examining data/clsync-0.4.5/mon_dtracepipe.h Examining data/clsync-0.4.5/mon_fanotify.c Examining data/clsync-0.4.5/mon_fanotify.h Examining data/clsync-0.4.5/mon_gio.c Examining data/clsync-0.4.5/mon_gio.h Examining data/clsync-0.4.5/mon_inotify.c Examining data/clsync-0.4.5/mon_inotify.h Examining data/clsync-0.4.5/mon_kqueue.c Examining data/clsync-0.4.5/mon_kqueue.h Examining data/clsync-0.4.5/port-hacks.h Examining data/clsync-0.4.5/posix-hacks.c Examining data/clsync-0.4.5/posix-hacks.h Examining data/clsync-0.4.5/privileged.c Examining data/clsync-0.4.5/privileged.h Examining data/clsync-0.4.5/pthreadex.c Examining data/clsync-0.4.5/pthreadex.h Examining data/clsync-0.4.5/rules.c Examining data/clsync-0.4.5/rules.h Examining data/clsync-0.4.5/socket.c Examining data/clsync-0.4.5/socket.h Examining data/clsync-0.4.5/stringex.c Examining data/clsync-0.4.5/stringex.h Examining data/clsync-0.4.5/sync.c Examining data/clsync-0.4.5/sync.h Examining data/clsync-0.4.5/syscalls.c Examining data/clsync-0.4.5/syscalls.h FINAL RESULTS: data/clsync-0.4.5/control.c:215:10: [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 ( ctx_p->socketpath, ctx_p->socketmod ) ) { data/clsync-0.4.5/control.c:222:10: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if ( chown ( ctx_p->socketpath, ctx_p->socketuid, ctx_p->socketgid ) ) { data/clsync-0.4.5/fileutils.c:51:20: [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. if ( ( fpathlen = readlink ( fsym, fpath, fpathlen + 1 ) ) < 0 ) { data/clsync-0.4.5/error.c:60:7: [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. rc = vfprintf ( stderr, fmt, args ); data/clsync-0.4.5/error.c:70:7: [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. rc = vfprintf ( stdout, fmt, args ); data/clsync-0.4.5/error.c:77:9: [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. return vfprintf ( stderr, fmt, args ); data/clsync-0.4.5/error.c:82:9: [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. return vfprintf ( stdout, fmt, args ); data/clsync-0.4.5/error.c:129:8: [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 ( data/clsync-0.4.5/examples/clsync-synchandler-rsyncso.c:74:4: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(argv[0], (char *const *)argv); data/clsync-0.4.5/examples/clsync-synchandler-so.c:83:4: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(argv[0], (char *const *)argv); data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c:114:13: [4] (shell) execv: 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. execv(argv[0], argv); data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-pdcp.c:74:13: [4] (shell) execv: 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. execv(argv[0], argv); data/clsync-0.4.5/main.c:2519:9: [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 ( ctx_p->exithookfile, X_OK ) == -1 ) { data/clsync-0.4.5/main.c:2536:8: [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 ( ctx_p->handlerfpath, X_OK ) == -1 ) { data/clsync-0.4.5/malloc.c:152:2: [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 ( dst, src ); data/clsync-0.4.5/mon_bsm.c:177:4: [4] (shell) execl: 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. execl ( AUDIT_CONTROL_INITSCRIPT, AUDIT_CONTROL_INITSCRIPT, "onerestart", NULL ); data/clsync-0.4.5/mon_bsm.c:218:8: [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 ( AUDIT_CONTROL_PATH"-clsync_backup", R_OK ) ) { data/clsync-0.4.5/mon_bsm.c:281:8: [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 ( AUDIT_CONTROL_PATH"-clsync_backup", R_OK ) ) { data/clsync-0.4.5/mon_dtracepipe.c:66:7: [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. if ( snprintf ( cmd, "%s -n '%s' '%s'", DTRACE_PATH, DTRACE_SCRIPT, ) >= BUFSIZ ) { data/clsync-0.4.5/mon_dtracepipe.c:72:15: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. FILE *pipe = popen ( cmd, "r" ); data/clsync-0.4.5/mon_inotify.c:134:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf ( path_full, "%s/%s", fpath, event->name ); data/clsync-0.4.5/mon_inotify.c:136:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf ( path_full, "%s", fpath ); data/clsync-0.4.5/privileged.c:1191:16: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. exit ( execvp ( file, argv ) ); data/clsync-0.4.5/privileged.c:1825:5: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp ( file, argv ); data/clsync-0.4.5/socket.c:200:8: [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 ( socket_path, F_OK ) ) data/clsync-0.4.5/socket.c:245: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 ( socket_path, F_OK ) ) { data/clsync-0.4.5/socket.c:287:8: [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 ( prebuf0, PREBUF0_SIZE, textmessage_args[cmd_id], ap_copy ); data/clsync-0.4.5/socket.c:292:7: [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 ( prebuf1, PREBUF1_SIZE, textmessage_descr[cmd_id], ap ); data/clsync-0.4.5/socket.c:412:7: [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(args, textmessage_args[sockcmd_p->cmd_id], __VA_ARGS__) < min_args)\ data/clsync-0.4.5/sync.c:1976:59: [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. # warning Do not know how to set inotify flags (too old system) data/clsync-0.4.5/sync.c:2962: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 ( dosync_arg_p->excf_path, newexc_path ); // TODO: optimize this out data/clsync-0.4.5/sync.c:3140:6: [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 ( dosync_arg.excf_path, dosync_arg.outf_path ); // TODO: remove this strcpy() data/clsync-0.4.5/main.c:2020:7: [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. c = getopt_long ( argc, argv, optstring, long_options, &option_index ); data/clsync-0.4.5/main.c:2108:24: [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 *homedir = getenv ( "HOME" ); data/clsync-0.4.5/main.c:2861:21: [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 *rwatchdir = realpath ( ctx_p->watchdir, NULL ); data/clsync-0.4.5/main.c:2967:20: [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 *rdestdir = realpath ( ctx_p->destdir, NULL ); data/clsync-0.4.5/main.c:3000:26: [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. ctx_p->rulfpath = realpath ( ctx_p->rulfpath, NULL ); data/clsync-0.4.5/main.c:3010:25: [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 *rhandlerfpath = realpath ( ctx_p->handlerfpath, NULL ); data/clsync-0.4.5/main.c:3220:9: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if ( chroot ( "." ) ) { data/clsync-0.4.5/main.c:3340:19: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *tempdir = getenv ( "TMPDIR" ); data/clsync-0.4.5/sync.c:3804: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. dprintf ( fd_out, "status == %s\n", getenv ( "CLSYNC_STATUS" ) ); // TODO: remove getenv() from here data/clsync-0.4.5/sync.c:4164:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand ( time ( NULL ) ); data/clsync-0.4.5/cgroup.c:41: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 control_name_buf[BUFSIZ + BUFSIZ] = {[0 ... BUFSIZ - 1] = '/', 'd', 'e', 'v', 'i', 'c', 'e', 's', '.', 'a', 'l', 'l', 'o', 'w'}, *control_name = &control_name_buf[BUFSIZ]; data/clsync-0.4.5/cluster.c:160:2: [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 ( &queuedpacket_p->cmd, clustercmd_p, clustercmd_size ); data/clsync-0.4.5/cluster.c:242: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 ( &adler32_save.hdr, &clustercmd_p->h.adler32.hdr, sizeof ( clustercmd_p->h.adler32.hdr ) ); data/clsync-0.4.5/cluster.c:460: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 buf[CLUSTER_PACKET_MAXSIZE]; data/clsync-0.4.5/cluster.c:952: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 ( node_name, data_welcome_p->from_node_name, data_welcome_p->from_node_name_len ); data/clsync-0.4.5/cluster.c:984: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 ( answer_data_p->from_node_name, ctx_p->cluster_nodename, ctx_p->cluster_nodename_len ); data/clsync-0.4.5/cluster.c:985: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 ( welcome_to_node_name ( answer_data_p ), data_hello_p->node_name, clustercmd_p->h.data_len ); data/clsync-0.4.5/cluster.c:989: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 ( node_name, data_hello_p->node_name, clustercmd_p->h.data_len + 1 ); data/clsync-0.4.5/cluster.c:1019:2: [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 ( node_name, data_register_p->node_name, clustercmd_p->h.data_len + 1 ); data/clsync-0.4.5/cluster.c:1142: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 ( clustercmd_p->data.hello.node_name, ctx_p->cluster_nodename, clustercmd_p->h.data_len + 1 ); data/clsync-0.4.5/cluster.c:1189: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_reg_p->node_name, ctx_p->cluster_nodename, ctx_p->cluster_nodename_len + 1 ); data/clsync-0.4.5/cluster.c:1465:2: [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 ( dirpath_rel, dirpath_rel_full, dirpath_rel_end ); data/clsync-0.4.5/cluster.c:1596: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/clsync-0.4.5/cluster.c:1604:34: [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 * ) clustercmd_ht_exch_p ) [offset] ); data/clsync-0.4.5/cluster.h:133: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 node_name[0]; data/clsync-0.4.5/cluster.h:141: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 from_node_name[0]; data/clsync-0.4.5/cluster.h:147: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 node_name[0]; data/clsync-0.4.5/cluster.h:171: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 path[0]; data/clsync-0.4.5/cluster.h:198: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 p[0]; data/clsync-0.4.5/cluster.h:216: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 ack_from[MAXNODES]; data/clsync-0.4.5/common.h:162: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 excf_path[PATH_MAX + 1]; data/clsync-0.4.5/common.h:163: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 outf_path[PATH_MAX + 1]; data/clsync-0.4.5/common.h:171: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[BUFSIZ + 1]; data/clsync-0.4.5/common.h:174:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *include_list[MAXARGUMENTS + 2]; data/clsync-0.4.5/ctx.h:251: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 *v[MAXARGUMENTS]; data/clsync-0.4.5/ctx.h:253: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 isexpanded[MAXARGUMENTS]; data/clsync-0.4.5/ctx.h:319: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 pid_str[65]; data/clsync-0.4.5/ctx.h:337: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 *flags_values_raw[OPTION_FLAGS]; data/clsync-0.4.5/ctx.h:343: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 *customsignal[MAXSIGNALNUM + 1]; data/clsync-0.4.5/ctx.h:397: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 isignoredexitcode[ ( 1 << 8 )]; data/clsync-0.4.5/ctx.h:404: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 *permitted_hookfile[MAXPERMITTEDHOOKFILES + 1]; data/clsync-0.4.5/ctx.h:410: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 *mountpoint[MAXMOUNTPOINTS + 1]; data/clsync-0.4.5/error.c:101:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char _syslog_buffer[SYSLOG_BUFSIZ + 1] = {0}; data/clsync-0.4.5/examples/clsync-synchandler-rsyncso.c:17: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. static const char *argv[11] = {NULL}; data/clsync-0.4.5/examples/clsync-synchandler-so.c:62:22: [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. argv[argv_i++] = (char *)ei[ei_i].path; data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c:65: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(ret, path, size); data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c:66: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(ret+size, decrement, decrement_size); data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c:73: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 *argv[ARGV_SIZE]; data/clsync-0.4.5/fileutils.c:38:2: [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 ( fsym, "/proc/self/fd/%i", fd ); data/clsync-0.4.5/fileutils.c:80: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[BUFSIZ]; data/clsync-0.4.5/fileutils.c:82: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). from = fopen ( path_from, "r" ); data/clsync-0.4.5/fileutils.c:90: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). to = fopen ( path_to, "w" ); data/clsync-0.4.5/indexes.h:96:2: [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 ( fpath, fpath_const, fpathlen + 1 ); data/clsync-0.4.5/indexes.h:189:2: [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 ( fpath, fpath_const, fpathlen + 1 ); data/clsync-0.4.5/main.c:816:10: [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 ( &ret[ret_len], variable_value, variable_value_len ); data/clsync-0.4.5/main.c:981:31: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). signal = ( unsigned int ) atoi ( start ); data/clsync-0.4.5/main.c:1763:37: [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). exitcode = ( unsigned char ) atoi ( start ); data/clsync-0.4.5/main.c:1854: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 ( ctx_p->destproto, arg, len ); data/clsync-0.4.5/main.c:1904:6: [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 user[USER_LEN + 2], group[GROUP_LEN + 2]; data/clsync-0.4.5/main.c:1905:6: [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 ( user, arg, MIN ( USER_LEN, colon - arg ) ); data/clsync-0.4.5/main.c:2120: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 ( config_path_real, homedir, homedir_len ); data/clsync-0.4.5/main.c:2122: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 ( &config_path_real[homedir_len + 1], *config_path_p, config_path_len + 1 ); data/clsync-0.4.5/main.c:2124: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 ( config_path_real, *config_path_p, config_path_len + 1 ); data/clsync-0.4.5/main.c:2957: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 ( newwatchdir, ctx_p->watchdir, ctx_p->watchdirlen ); data/clsync-0.4.5/main.c:2960: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 ( &ctx_p->watchdirwslash[ctx_p->watchdirlen], "/", 2 ); data/clsync-0.4.5/main.c:2990: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 ( newdestdir, ctx_p->destdir, ctx_p->destdirlen ); data/clsync-0.4.5/main.c:2993: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 ( &ctx_p->destdirwslash[ctx_p->destdirlen], "/", 2 ); data/clsync-0.4.5/main.c:3250: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). main_statusfile_f = fopen ( ctx_p->statusfile, "w" ); data/clsync-0.4.5/main.c:3313: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). main_statusfile_f = fopen ( ctx_p->statusfile, "w" ); data/clsync-0.4.5/main.c:3349: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 ( template, tempdir, tempdir_len); data/clsync-0.4.5/main.c:3350: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 ( template + tempdir_len, tempsuff, tempsuff_len); data/clsync-0.4.5/main.c:3403: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 *pidfile = fopen ( ctx_p->pidfile, "w" ); data/clsync-0.4.5/main.c:3416:33: [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). if ( !errno ) SAFE ( ( fd = open ( ctx_p->pidfile, O_CREAT | O_WRONLY, 0644 ) ) == -1, ret = errno ); data/clsync-0.4.5/main.c:3424:15: [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). pidfile = fopen ( ctx_p->pidfile, "w" ); data/clsync-0.4.5/main.c:3458: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). SAFE ( ( pidfile = fopen ( ctx_p->pidfile, "w" ) ) == NULL, ret = errno ); data/clsync-0.4.5/malloc.c:186: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). devzero_fd = open ( DEVZERO, O_RDONLY ); data/clsync-0.4.5/mon_bsm.c:35: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 path [PATH_MAX]; data/clsync-0.4.5/mon_bsm.c:36: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 path_to[PATH_MAX]; data/clsync-0.4.5/mon_bsm.c:201: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[sizeof ( AUDIT_CONTROL_HEADER )]; data/clsync-0.4.5/mon_bsm.c:202:11: [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 ( AUDIT_CONTROL_PATH, O_RDONLY ); data/clsync-0.4.5/mon_bsm.c:244:23: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). mondata->config_fd = open ( AUDIT_CONTROL_PATH, O_RDONLY ); data/clsync-0.4.5/mon_bsm.c:246:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd_w = open ( AUDIT_CONTROL_PATH, O_WRONLY | O_CREAT ); data/clsync-0.4.5/mon_bsm.c:313:15: [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 *pipe = fopen ( AUDITPIPE_PATH, "r" ); data/clsync-0.4.5/mon_bsm.c:521:10: [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_p->path, tok.tt.path.path, tok.tt.path.len + 1 ); data/clsync-0.4.5/mon_bsm.c:525:10: [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_p->path_to, tok.tt.path.path, tok.tt.path.len + 1 ); data/clsync-0.4.5/mon_bsm.c:721: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_p, &event, sizeof ( *event_p ) ); data/clsync-0.4.5/mon_dtracepipe.c:62: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 cmd[BUFSIZ]; data/clsync-0.4.5/mon_dtracepipe.c:188:10: [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_p->path, tok.tt.path.path, tok.tt.path.len + 1 ); data/clsync-0.4.5/mon_dtracepipe.c:192:10: [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_p->path_to, tok.tt.path.path, tok.tt.path.len + 1 ); data/clsync-0.4.5/mon_inotify.c:90: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[BUFSIZ + 1]; data/clsync-0.4.5/mon_kqueue.c:234: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). obj_p->fd = open ( ctx_p->watchdir, O_RDONLY | O_NOFOLLOW ); data/clsync-0.4.5/mon_kqueue.c:306: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 ( &dat->changelist[obj_p->changelist_id], &dat->changelist[changelist_id_last], sizeof ( *dat->changelist ) ); data/clsync-0.4.5/mon_kqueue.c:341:2: [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 ( obj_p->name, fname, obj_p->name_len + 1 ); data/clsync-0.4.5/mon_kqueue.c:553: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 filepath[PATH_MAX + 2]; data/clsync-0.4.5/mon_kqueue.c:585:2: [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 ( filepath, dirpath, dirpath_len ); data/clsync-0.4.5/mon_kqueue.c:587:2: [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 ( &filepath[dirpath_len + 1], obj_p->name, obj_p->name_len + 1 ); data/clsync-0.4.5/mon_kqueue.c:685:2: [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 ( dst, src, sizeof ( *src ) ); data/clsync-0.4.5/mon_kqueue.c:687:2: [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 ( dst->name, src->name, src->name_len + 1 ); data/clsync-0.4.5/mon_kqueue.c:712: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 ( ctx_p->watchdir, O_RDONLY | O_PATH ); data/clsync-0.4.5/posix-hacks.c:67: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). return fopen ( path, mode ); data/clsync-0.4.5/posix-hacks.h:23:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). # define fopen posixhacks_fopen data/clsync-0.4.5/privileged.c:95:30: [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). SECCOMP_ALLOW_ACCUM_SYSCALL(open), \ data/clsync-0.4.5/privileged.c:222: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 path_buf[PATH_MAX]; data/clsync-0.4.5/privileged.c:227: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 _path_argv[MAXARGUMENTS + 1][PATH_MAX]; data/clsync-0.4.5/privileged.c:228: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 *path_argv[MAXARGUMENTS + 1]; data/clsync-0.4.5/privileged.c:236: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 pathname[PATH_MAX]; data/clsync-0.4.5/privileged.c:247: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 file[PATH_MAX]; data/clsync-0.4.5/privileged.c:249: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 _argv[MAXARGUMENTS + 1][BUFSIZ]; data/clsync-0.4.5/privileged.c:250: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 *argv[MAXARGUMENTS + 1]; data/clsync-0.4.5/privileged.c:319: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 fts_accpath[PATH_MAX]; data/clsync-0.4.5/privileged.c:320: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 fts_path[PATH_MAX]; data/clsync-0.4.5/privileged.c:321: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 fts_name[PATH_MAX]; data/clsync-0.4.5/privileged.c:375: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 *permitted_hookfile[MAXPERMITTEDHOOKFILES + 1]; data/clsync-0.4.5/privileged.c:911: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[1] = {0}; data/clsync-0.4.5/privileged.c:1309: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[1] = {0}; data/clsync-0.4.5/privileged.c:1496:2: [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, ( void * ) &cmd_ret_p->ret_buf.stat64, sizeof ( stat64_t ) ); data/clsync-0.4.5/privileged.c:1516:2: [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, ( void * ) &cmd_ret_p->ret_buf.stat64, sizeof ( stat64_t ) ); data/clsync-0.4.5/privileged.c:1844:2: [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 ( mutex, &initial, sizeof ( *mutex ) ); data/clsync-0.4.5/privileged.c:1881:2: [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 ( cond, &initial, sizeof ( *cond ) ); data/clsync-0.4.5/pthreadex.c:29:2: [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 ( *mutex_p, &mutex_initial, sizeof ( mutex_initial ) ); data/clsync-0.4.5/pthreadex.c:48:2: [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 ( *cond_p, &cond_initial, sizeof ( cond_initial ) ); data/clsync-0.4.5/rules.c:38: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[BUFSIZ]; data/clsync-0.4.5/rules.c:63:12: [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 ( rulfpath, "r" ); data/clsync-0.4.5/rules.c:221:6: [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 ( expr, line, linelen + 1 ); data/clsync-0.4.5/socket.c:43:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char clsyncsockthread_busy[SOCKET_MAX + 1] = {0}; data/clsync-0.4.5/socket.c:69:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char *recv_stps[SOCKET_MAX]; data/clsync-0.4.5/socket.c:70:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char *recv_ptrs[SOCKET_MAX]; data/clsync-0.4.5/socket.c:72: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. const char *const textmessage_args[SOCKCMD_MAXID] = { data/clsync-0.4.5/socket.c:88: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. const char *const textmessage_descr[SOCKCMD_MAXID] = { data/clsync-0.4.5/socket.c:275: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 prebuf0[PREBUF0_SIZE], prebuf1[PREBUF1_SIZE], sendbuf[SOCKET_BUFSIZ]; data/clsync-0.4.5/socket.c:424:28: [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. const char *ptr = ( const char * ) textmessage_args[sockcmd_p->cmd_id]; data/clsync-0.4.5/socket.c:493: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 ( sockcmd_p->data, args, args_len ); data/clsync-0.4.5/socket.c:503: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 bufs[SOCKET_MAX][SOCKET_BUFSIZ]; data/clsync-0.4.5/socket.c:631: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 _sockcmd_buf[SOCKET_BUFSIZ] = {0}; data/clsync-0.4.5/socket.c:669:6: [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 ( cbq, &clsyncsock_p->cbqueue[--clsyncsock_p->cbqueue_len], sizeof ( *cbq ) ); data/clsync-0.4.5/socket.h:153: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 revision[1 << 8]; data/clsync-0.4.5/socket.h:158: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 config_block[1 << 8]; data/clsync-0.4.5/socket.h:159: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 label[1 << 8]; data/clsync-0.4.5/socket.h:160: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 flags[OPTION_FLAGS]; data/clsync-0.4.5/socket.h:161: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 flags_set[OPTION_FLAGS]; data/clsync-0.4.5/socket.h:166: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 dir_path[PATH_MAX]; data/clsync-0.4.5/socket.h:171: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 file_path[PATH_MAX]; data/clsync-0.4.5/socket.h:176: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 descr[BUFSIZ]; data/clsync-0.4.5/socket.h:181: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 key[BUFSIZ]; data/clsync-0.4.5/socket.h:182: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 value[BUFSIZ]; data/clsync-0.4.5/stringex.c:60: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 ( arg, arg_start, arg_len ); data/clsync-0.4.5/sync.c:78: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 iterations[sizeof ( "4294967296" )]; // 4294967296 == 2**32 data/clsync-0.4.5/sync.c:79:2: [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 ( iterations, "%i", iteration_num ); data/clsync-0.4.5/sync.c:104:2: [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 ( ei_dup, ei, sizeof ( *ei ) ); data/clsync-0.4.5/sync.c:376: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 ( threadinfo_p, t, sizeof ( *threadinfo_p ) ); data/clsync-0.4.5/sync.c:1006: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_abs, ctx_p->watchdir, watchdirlen ); data/clsync-0.4.5/sync.c:1010:2: [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_abs[watchdirlen + 1], path_rel, path_rel_len + 1 ); data/clsync-0.4.5/sync.c:1041:2: [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_rel, &path_abs[watchdirlen + 1], path_rel_len + 1 ); data/clsync-0.4.5/sync.c:1282: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 ( evinfo_dup, evinfo, sizeof ( *evinfo_dup ) ); data/clsync-0.4.5/sync.c:2074:2: [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 ( evmask_str, "%u", evmask ); data/clsync-0.4.5/sync.c:2359: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 buf[PATH_MAX + 2] = {0}; data/clsync-0.4.5/sync.c:2380:2: [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, fpath, fpath_len + 1 ); data/clsync-0.4.5/sync.c:2441: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 ( evinfo_dup, evinfo, sizeof ( *evinfo ) ); data/clsync-0.4.5/sync.c:2659: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). dosync_arg_p->outf = fopen ( fpath, "w" ); data/clsync-0.4.5/sync.c:2780: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 ( &fpathwslash[1], fpath, fpath_len + 1 ); data/clsync-0.4.5/sync.c:2835: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 ( &fpathwslash[1], fpath, fpath_len + 1 ); data/clsync-0.4.5/sync.c:2933: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 newexc_path[PATH_MAX + 1]; data/clsync-0.4.5/sync.c:3741: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[BUFSIZ]; data/clsync-0.4.5/sync.c:3830: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[BUFSIZ]; data/clsync-0.4.5/cluster.c:1444: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). size_t dirpath_len = strlen ( dirpath ); data/clsync-0.4.5/cluster.c:1497: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 size = strlen ( dir ) + 1; // TODO: strlen should be already prepared data/clsync-0.4.5/examples/production/etc/clsync/synchandler/hpc/handler-backup.c:34: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). decrement_size = strlen(decrement); data/clsync-0.4.5/indexes.h:186:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t fpathlen = strlen ( fpath_const ); data/clsync-0.4.5/macros.h:53: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). if (unlikely( strlen(str) >= limit ))\ data/clsync-0.4.5/main.c:779:33: [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). ctx_p->pid_str_len = strlen ( ctx_p->pid_str ); data/clsync-0.4.5/main.c:803: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). variable_value_len = strlen ( variable_value ); data/clsync-0.4.5/main.c:897:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( synchandler_arg ( strdup ( *args_p ), strlen ( *args_p ), ctx_p, shargsid ) ) data/clsync-0.4.5/main.c:1609: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 ( arg ) ) { data/clsync-0.4.5/main.c:1733: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 ( arg ) ) { data/clsync-0.4.5/main.c:1744: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 ( arg ) ) { data/clsync-0.4.5/main.c:2109:48: [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 homedir_len = ( homedir == NULL ? 0 : strlen ( homedir ) ); data/clsync-0.4.5/main.c:2112: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). size_t config_path_len = strlen ( *config_path_p ); data/clsync-0.4.5/main.c:2372: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). ctx_p->cluster_nodename_len = strlen ( ctx_p->cluster_nodename ); data/clsync-0.4.5/main.c:2937: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). ctx_p->watchdirlen = strlen ( ctx_p->watchdir ); data/clsync-0.4.5/main.c:2978:25: [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). ctx_p->destdirlen = strlen ( ctx_p->destdir ); data/clsync-0.4.5/main.c:3344: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 tempdir_len = strlen(tempdir); data/clsync-0.4.5/main.c:3345:25: [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 tempsuff_len = strlen(tempsuff); data/clsync-0.4.5/malloc.c:96:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). char *ret = strncpy ( dest, src, n - 1 ); data/clsync-0.4.5/malloc.c:150:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen ( src ) + 1; data/clsync-0.4.5/malloc.c:166:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is_protected = ( read ( devzero_fd, addr, 1 ) == -1 ); data/clsync-0.4.5/mon_bsm.c:209:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int r = read ( fd, buf, sizeof ( AUDIT_CONTROL_HEADER ) - 1 ); data/clsync-0.4.5/mon_fanotify.c:36:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t len = read ( fanotify_d, ( void * ) buf, sizeof ( buf ) - sizeof ( *buf ) ); data/clsync-0.4.5/mon_inotify.c:91:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t r = read ( inotify_d, buf, BUFSIZ ); data/clsync-0.4.5/mon_inotify.c:126:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t path_full_memreq = strlen ( fpath ) + event->len + 2; data/clsync-0.4.5/mon_kqueue.c:391:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t name_len = strlen ( entry->d_name ); data/clsync-0.4.5/mon_kqueue.c:456:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). name_len = strlen ( file_name ); data/clsync-0.4.5/mon_kqueue.c:574: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). dirpath_len = strlen ( dirpath ); data/clsync-0.4.5/mon_kqueue.c:644: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). obj.name_len = strlen ( entry->d_name ); data/clsync-0.4.5/privileged.c:108:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). SECCOMP_ALLOW_ACCUM_SYSCALL(read), \ data/clsync-0.4.5/socket.c:213:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy ( addr.sun_path, socket_path, sizeof ( addr.sun_path ) - 1 ); data/clsync-0.4.5/socket.c:257:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy ( addr.sun_path, socket_path, sizeof ( addr.sun_path ) - 1 ); data/clsync-0.4.5/sync.c:994: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). path_rel_len = strlen ( path_rel ); data/clsync-0.4.5/sync.c:1024: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). path_abs_len = strlen ( path_abs ); data/clsync-0.4.5/sync.c:1708: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). ei->path_len = strlen ( path ); data/clsync-0.4.5/sync.c:2379:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t fpath_len = strlen ( fpath ); data/clsync-0.4.5/sync.c:2828:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t fpath_len = strlen ( fpath ); data/clsync-0.4.5/sync.c:2999:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ei->path_len = strlen ( fpath ); data/clsync-0.4.5/sync.c:3047:50: [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 ( ( ret = rsync_listpush ( indexes_p, fpath, strlen ( fpath ), evinfo->flags, linescount_p ) ) ) { data/clsync-0.4.5/syscalls.h:28:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read ( fd, buf, count ); ANALYSIS SUMMARY: Hits = 236 Lines analyzed = 20795 in approximately 0.58 seconds (36112 lines/second) Physical Source Lines of Code (SLOC) = 15059 Hits@level = [0] 30 [1] 40 [2] 154 [3] 10 [4] 29 [5] 3 Hits@level+ = [0+] 266 [1+] 236 [2+] 196 [3+] 42 [4+] 32 [5+] 3 Hits/KSLOC@level+ = [0+] 17.6639 [1+] 15.6717 [2+] 13.0155 [3+] 2.78903 [4+] 2.12498 [5+] 0.199216 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.