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/snoopy-2.4.9/lib/inih/src/ini.c Examining data/snoopy-2.4.9/lib/inih/src/ini.h Examining data/snoopy-2.4.9/lib/liblcthw/src/dbg.h Examining data/snoopy-2.4.9/lib/liblcthw/src/list.c Examining data/snoopy-2.4.9/lib/liblcthw/src/list.h Examining data/snoopy-2.4.9/src/configfile.h Examining data/snoopy-2.4.9/src/configuration.c Examining data/snoopy-2.4.9/src/configuration.h Examining data/snoopy-2.4.9/src/datasource/cmdline.c Examining data/snoopy-2.4.9/src/datasource/cmdline.h Examining data/snoopy-2.4.9/src/datasource/cwd.c Examining data/snoopy-2.4.9/src/datasource/cwd.h Examining data/snoopy-2.4.9/src/datasource/datetime.c Examining data/snoopy-2.4.9/src/datasource/datetime.h Examining data/snoopy-2.4.9/src/datasource/domain.c Examining data/snoopy-2.4.9/src/datasource/domain.h Examining data/snoopy-2.4.9/src/datasource/egid.c Examining data/snoopy-2.4.9/src/datasource/egid.h Examining data/snoopy-2.4.9/src/datasource/egroup.c Examining data/snoopy-2.4.9/src/datasource/egroup.h Examining data/snoopy-2.4.9/src/datasource/env.c Examining data/snoopy-2.4.9/src/datasource/env.h Examining data/snoopy-2.4.9/src/datasource/env_all.c Examining data/snoopy-2.4.9/src/datasource/env_all.h Examining data/snoopy-2.4.9/src/datasource/euid.c Examining data/snoopy-2.4.9/src/datasource/euid.h Examining data/snoopy-2.4.9/src/datasource/eusername.c Examining data/snoopy-2.4.9/src/datasource/eusername.h Examining data/snoopy-2.4.9/src/datasource/filename.c Examining data/snoopy-2.4.9/src/datasource/filename.h Examining data/snoopy-2.4.9/src/datasource/gid.c Examining data/snoopy-2.4.9/src/datasource/gid.h Examining data/snoopy-2.4.9/src/datasource/group.c Examining data/snoopy-2.4.9/src/datasource/group.h Examining data/snoopy-2.4.9/src/datasource/hostname.c Examining data/snoopy-2.4.9/src/datasource/hostname.h Examining data/snoopy-2.4.9/src/datasource/login.c Examining data/snoopy-2.4.9/src/datasource/login.h Examining data/snoopy-2.4.9/src/datasource/noop.c Examining data/snoopy-2.4.9/src/datasource/noop.h Examining data/snoopy-2.4.9/src/datasource/pid.c Examining data/snoopy-2.4.9/src/datasource/pid.h Examining data/snoopy-2.4.9/src/datasource/ppid.c Examining data/snoopy-2.4.9/src/datasource/ppid.h Examining data/snoopy-2.4.9/src/datasource/rpname.c Examining data/snoopy-2.4.9/src/datasource/rpname.h Examining data/snoopy-2.4.9/src/datasource/sid.c Examining data/snoopy-2.4.9/src/datasource/sid.h Examining data/snoopy-2.4.9/src/datasource/snoopy_literal.c Examining data/snoopy-2.4.9/src/datasource/snoopy_literal.h Examining data/snoopy-2.4.9/src/datasource/snoopy_threads.c Examining data/snoopy-2.4.9/src/datasource/snoopy_threads.h Examining data/snoopy-2.4.9/src/datasource/snoopy_version.c Examining data/snoopy-2.4.9/src/datasource/snoopy_version.h Examining data/snoopy-2.4.9/src/datasource/tid.c Examining data/snoopy-2.4.9/src/datasource/tid.h Examining data/snoopy-2.4.9/src/datasource/tid_kernel.c Examining data/snoopy-2.4.9/src/datasource/tid_kernel.h Examining data/snoopy-2.4.9/src/datasource/timestamp.c Examining data/snoopy-2.4.9/src/datasource/timestamp.h Examining data/snoopy-2.4.9/src/datasource/timestamp_ms.c Examining data/snoopy-2.4.9/src/datasource/timestamp_ms.h Examining data/snoopy-2.4.9/src/datasource/timestamp_us.c Examining data/snoopy-2.4.9/src/datasource/timestamp_us.h Examining data/snoopy-2.4.9/src/datasource/tty.c Examining data/snoopy-2.4.9/src/datasource/tty.h Examining data/snoopy-2.4.9/src/datasource/tty_uid.c Examining data/snoopy-2.4.9/src/datasource/tty_uid.h Examining data/snoopy-2.4.9/src/datasource/tty_username.c Examining data/snoopy-2.4.9/src/datasource/tty_username.h Examining data/snoopy-2.4.9/src/datasource/uid.c Examining data/snoopy-2.4.9/src/datasource/uid.h Examining data/snoopy-2.4.9/src/datasource/username.c Examining data/snoopy-2.4.9/src/datasource/username.h Examining data/snoopy-2.4.9/src/datasourceregistry.c Examining data/snoopy-2.4.9/src/datasourceregistry.h Examining data/snoopy-2.4.9/src/error.c Examining data/snoopy-2.4.9/src/error.h Examining data/snoopy-2.4.9/src/eventsource/execve_wrapper.c Examining data/snoopy-2.4.9/src/eventsource/execve_wrapper.h Examining data/snoopy-2.4.9/src/filter/exclude_spawns_of.c Examining data/snoopy-2.4.9/src/filter/exclude_spawns_of.h Examining data/snoopy-2.4.9/src/filter/exclude_uid.c Examining data/snoopy-2.4.9/src/filter/exclude_uid.h Examining data/snoopy-2.4.9/src/filter/noop.c Examining data/snoopy-2.4.9/src/filter/noop.h Examining data/snoopy-2.4.9/src/filter/only_root.c Examining data/snoopy-2.4.9/src/filter/only_root.h Examining data/snoopy-2.4.9/src/filter/only_tty.c Examining data/snoopy-2.4.9/src/filter/only_tty.h Examining data/snoopy-2.4.9/src/filter/only_uid.c Examining data/snoopy-2.4.9/src/filter/only_uid.h Examining data/snoopy-2.4.9/src/filtering.c Examining data/snoopy-2.4.9/src/filtering.h Examining data/snoopy-2.4.9/src/filterregistry.c Examining data/snoopy-2.4.9/src/filterregistry.h Examining data/snoopy-2.4.9/src/genericregistry.c Examining data/snoopy-2.4.9/src/genericregistry.h Examining data/snoopy-2.4.9/src/inputdatastorage.c Examining data/snoopy-2.4.9/src/inputdatastorage.h Examining data/snoopy-2.4.9/src/libsnoopy-debug-addons.h Examining data/snoopy-2.4.9/src/log.c Examining data/snoopy-2.4.9/src/log.h Examining data/snoopy-2.4.9/src/message.c Examining data/snoopy-2.4.9/src/message.h Examining data/snoopy-2.4.9/src/misc.h Examining data/snoopy-2.4.9/src/output/devlogoutput.c Examining data/snoopy-2.4.9/src/output/devlogoutput.h Examining data/snoopy-2.4.9/src/output/devnulloutput.c Examining data/snoopy-2.4.9/src/output/devnulloutput.h Examining data/snoopy-2.4.9/src/output/devttyoutput.c Examining data/snoopy-2.4.9/src/output/devttyoutput.h Examining data/snoopy-2.4.9/src/output/fileoutput.c Examining data/snoopy-2.4.9/src/output/fileoutput.h Examining data/snoopy-2.4.9/src/output/noopoutput.c Examining data/snoopy-2.4.9/src/output/noopoutput.h Examining data/snoopy-2.4.9/src/output/socketoutput.c Examining data/snoopy-2.4.9/src/output/socketoutput.h Examining data/snoopy-2.4.9/src/output/stderroutput.c Examining data/snoopy-2.4.9/src/output/stderroutput.h Examining data/snoopy-2.4.9/src/output/stdoutoutput.c Examining data/snoopy-2.4.9/src/output/stdoutoutput.h Examining data/snoopy-2.4.9/src/output/syslogoutput.c Examining data/snoopy-2.4.9/src/output/syslogoutput.h Examining data/snoopy-2.4.9/src/outputregistry.c Examining data/snoopy-2.4.9/src/outputregistry.h Examining data/snoopy-2.4.9/src/parser.c Examining data/snoopy-2.4.9/src/parser.h Examining data/snoopy-2.4.9/src/tsrm.c Examining data/snoopy-2.4.9/src/tsrm.h Examining data/snoopy-2.4.9/src/configfile.c Examining data/snoopy-2.4.9/src/libsnoopy-debug-addons.c Examining data/snoopy-2.4.9/src/misc.c Examining data/snoopy-2.4.9/src/snoopy.h Examining data/snoopy-2.4.9/tests/bin/libsnoopy-test.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-configfile.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-datasource.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-exec-in-threads.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-filter.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-message-format.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-output.c Examining data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c Examining data/snoopy-2.4.9/util/snoopy-detect.c Examining data/snoopy-2.4.9/util/snoopy-dev-helper.c Examining data/snoopy-2.4.9/util/snoopy-run-everything.c Examining data/snoopy-2.4.9/util/snoopy-test-all-data-sources.c Examining data/snoopy-2.4.9/util/snoopy-test-output.c FINAL RESULTS: data/snoopy-2.4.9/src/configuration.c:145:14: [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 (0 != access(valuePtr, R_OK)) { data/snoopy-2.4.9/src/eventsource/execve_wrapper.c:57:5: [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. int execv (const char *filename, char *const argv[]) { data/snoopy-2.4.9/src/eventsource/execve_wrapper.h:32:5: [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. int execv (const char *filename, char *const argv[]); data/snoopy-2.4.9/src/misc.c:127:5: [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(&destString[destStringSize], appendThis); data/snoopy-2.4.9/src/output/devlogoutput.c:68:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(logMessageWithPrefix, "<%d>%s[%d]: %s", data/snoopy-2.4.9/tests/bin/libsnoopy-test.c:58:5: [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. int execv (const char *filename, char *const argv[]) { data/snoopy-2.4.9/tests/bin/snoopy-test-configfile.c:72:15: [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 (-1 == access(iniFilePath, R_OK)) { data/snoopy-2.4.9/tests/bin/snoopy-test-exec-in-threads.c:160:9: [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(cmd, argv); data/snoopy-2.4.9/src/configuration.c:138:16: [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. valuePtr = getenv("SNOOPY_INI"); data/snoopy-2.4.9/src/datasource/env.c:52:17: [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 *env = getenv(arg); data/snoopy-2.4.9/src/datasource/login.c:77:20: [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. loginptr = getenv("SUDO_USER"); data/snoopy-2.4.9/src/datasource/login.c:79: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. loginptr = getenv("LOGNAME"); data/snoopy-2.4.9/lib/inih/src/ini.c:84: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 line[INI_MAX_LINE]; data/snoopy-2.4.9/lib/inih/src/ini.c:94: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 section[MAX_SECTION] = ""; data/snoopy-2.4.9/lib/inih/src/ini.c:95: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 prev_name[MAX_NAME] = ""; data/snoopy-2.4.9/lib/inih/src/ini.c:237: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 = fopen(filename, "r"); data/snoopy-2.4.9/src/datasource/cwd.c:53: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 cwdBuf[PATH_MAX+1]; data/snoopy-2.4.9/src/datasource/datetime.c:56: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 timeBuffer[80]; data/snoopy-2.4.9/src/datasource/domain.c:68:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char hostname[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE+1]; // +1 - we add "." to the end of string data/snoopy-2.4.9/src/datasource/domain.c:69: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 line[HOSTS_LINE_SIZE_MAX]; data/snoopy-2.4.9/src/datasource/domain.c:101:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(HOSTS_PATH, "r"); data/snoopy-2.4.9/src/datasource/login.c:63:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char login[SNOOPY_DATASOURCE_LOGIN_loginSizeMaxWithNull]; data/snoopy-2.4.9/src/datasource/login.c:82:13: [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(login, "(unknown)"); data/snoopy-2.4.9/src/datasource/rpname.c:96: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 pid_file[50]; data/snoopy-2.4.9/src/datasource/rpname.c:103: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 returnValue[PROC_PID_STATUS_VAL_MAX_LENGTH_STR] = ""; data/snoopy-2.4.9/src/datasource/rpname.c:106:5: [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(pid_file, "/proc/%d/status", pid); data/snoopy-2.4.9/src/datasource/rpname.c:107:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(pid_file, "r"); data/snoopy-2.4.9/src/datasource/rpname.c:189:20: [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). ppid_int = atoi(ppid_str); data/snoopy-2.4.9/src/datasource/tty.c:53: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 ttyPath[SNOOPY_DATASOURCE_TTY_sizeMaxWithNull]; data/snoopy-2.4.9/src/datasource/tty_uid.c:57: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 ttyPath[SNOOPY_DATASOURCE_TTY_sizeMaxWithNull]; data/snoopy-2.4.9/src/datasource/tty_username.c:60: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 ttyPath[SNOOPY_DATASOURCE_TTY_sizeMaxWithNull]; data/snoopy-2.4.9/src/filter/exclude_spawns_of.c:113: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 stat_path[32]; // Path "/proc/nnnn/stat" where nnnn = some PID data/snoopy-2.4.9/src/filter/exclude_spawns_of.c:126: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 st_commBuff[ST_COMM_SIZE_MAX]; data/snoopy-2.4.9/src/filter/exclude_spawns_of.c:137:9: [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(stat_path, "/proc/%d/stat", ppid); data/snoopy-2.4.9/src/filter/exclude_spawns_of.c:138:17: [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). statf = fopen(stat_path, "r"); data/snoopy-2.4.9/src/filter/exclude_uid.c:75:21: [2] (integer) atol: 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). argCurUid = atol(argParsed[i]); data/snoopy-2.4.9/src/filter/only_tty.c:53: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 ttyPath[SNOOPY_DATASOURCE_TTY_sizeMaxWithNull]; data/snoopy-2.4.9/src/filter/only_uid.c:75:21: [2] (integer) atol: 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). argCurUid = atol(argParsed[i]); data/snoopy-2.4.9/src/filtering.c:61: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 filterChainCopy[SNOOPY_FILTER_CHAIN_MAX_SIZE]; // Must be here, or strtok_r segfaults data/snoopy-2.4.9/src/filtering.c:74:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filterName[SNOOPY_FILTER_NAME_MAX_SIZE]; data/snoopy-2.4.9/src/filtering.c:77:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filterArg[SNOOPY_FILTER_ARG_MAX_SIZE]; data/snoopy-2.4.9/src/message.c:73:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fmtStaticText[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE]; data/snoopy-2.4.9/src/message.c:74:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dataSourceTag[100]; data/snoopy-2.4.9/src/message.c:79:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dataSourceArg[SNOOPY_DATASOURCE_ARG_MAX_SIZE]; data/snoopy-2.4.9/src/message.c:80:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dataSourceMsg[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE]; data/snoopy-2.4.9/src/output/fileoutput.c:64:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(arg, "a"); data/snoopy-2.4.9/tests/bin/snoopy-test-datasource.c:54: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 datasourceResult[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE]; data/snoopy-2.4.9/tests/bin/snoopy-test-exec-in-threads.c:81:23: [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). threadsToCreate = atoi(argv[1]); data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c:97:23: [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). threadsToCreate = atoi(argv[1]); data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c:191: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 dsResult[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE]; data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c:309:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buffer[sizeof(randomNrRaw)]; data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c:312:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open("/dev/urandom", O_RDONLY); data/snoopy-2.4.9/lib/inih/src/ini.c:36: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). char* p = s + strlen(s); data/snoopy-2.4.9/lib/inih/src/ini.c:73:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, size - 1); data/snoopy-2.4.9/lib/inih/src/ini.c:120: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). offset = strlen(line); data/snoopy-2.4.9/lib/inih/src/ini.c:135: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). offset += strlen(line + offset); data/snoopy-2.4.9/lib/inih/src/ini.c:191: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 ((*value == '"') && (value[strlen(value) - 1] == '"')) { data/snoopy-2.4.9/lib/inih/src/ini.c:192:27: [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). value[strlen(value) - 1] = '\0'; data/snoopy-2.4.9/lib/inih/src/ini.c:195:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((*value == '\'') && (value[strlen(value) - 1] == '\'')) { data/snoopy-2.4.9/lib/inih/src/ini.c:196:31: [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). value[strlen(value) - 1] = '\0'; data/snoopy-2.4.9/lib/inih/src/ini.c:277: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). ctx.num_left = strlen(string); data/snoopy-2.4.9/src/datasource/cmdline.c:77:27: [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). cmdLineSizeSum += strlen(snoopy_inputdatastorage->argv[i]) + 1; data/snoopy-2.4.9/src/datasource/domain.c:90:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (0 == strlen(hostname)) { data/snoopy-2.4.9/src/datasource/domain.c:95:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). tmpInt = strlen(hostname); data/snoopy-2.4.9/src/datasource/domain.c:130:40: [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). domainPtr = lineEntryPtr + strlen(hostname); data/snoopy-2.4.9/src/datasource/env_all.c:81:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((int)(strlen(envItem) + 3 + 1) < remResultSize) { data/snoopy-2.4.9/src/datasource/hostname.c:65: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). charCount = strlen(result); data/snoopy-2.4.9/src/datasource/login.c:84:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(login, loginptr, loginSizeMaxWithoutNull); // Coverity suggests using -1 size here data/snoopy-2.4.9/src/datasource/login.c:85: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). if ((int)strlen(loginptr) > loginSizeMaxWithoutNull) { data/snoopy-2.4.9/src/datasource/rpname.c:143: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). vLen = strlen(v); data/snoopy-2.4.9/src/datasource/rpname.c:152:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(returnValue, v, PROC_PID_STATUS_VAL_MAX_LENGTH); data/snoopy-2.4.9/src/datasource/rpname.c:155:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(returnValue, v, PROC_PID_STATUS_VAL_MAX_LENGTH_STR-1); data/snoopy-2.4.9/src/filter/exclude_spawns_of.c:161: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). st_comm[strlen(st_comm) - 1] = '\0'; data/snoopy-2.4.9/src/filtering.c:69:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filterChainCopy, filterChain, SNOOPY_FILTER_CHAIN_MAX_SIZE - 1); data/snoopy-2.4.9/src/filtering.c:100:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filterName, filterSpec, filterNameSize); data/snoopy-2.4.9/src/log.c:181:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (0 == strlen(logMessage)) { data/snoopy-2.4.9/src/message.c:71: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). while (strlen(fmtPos_nextFormatTag) > 0) { data/snoopy-2.4.9/src/message.c:91:62: [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 (lengthToCopy > (int)(SNOOPY_LOG_MESSAGE_MAX_SIZE-strlen(logMessage))) { data/snoopy-2.4.9/src/message.c:92:56: [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). lengthToCopy = SNOOPY_LOG_MESSAGE_MAX_SIZE-strlen(logMessage); data/snoopy-2.4.9/src/misc.c:119:31: [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). destStringSize = strlen(destString); data/snoopy-2.4.9/src/misc.c:120:31: [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). appendThisSize = strlen(appendThis); data/snoopy-2.4.9/src/output/socketoutput.c:64:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (0 == strlen(logMessage)) { data/snoopy-2.4.9/src/output/socketoutput.c:79:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(remote.sun_path, arg, 107); // Coverity suggests -1 here data/snoopy-2.4.9/src/output/socketoutput.c:80: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) > 107) { data/snoopy-2.4.9/src/output/socketoutput.c:84: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). remoteLength = strlen(remote.sun_path) + sizeof(remote.sun_family); data/snoopy-2.4.9/src/output/socketoutput.c:92: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 (send(s, logMessage, strlen(logMessage), MSG_DONTWAIT|MSG_NOSIGNAL) == -1) { data/snoopy-2.4.9/src/output/socketoutput.c:100: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). return strlen(logMessage); data/snoopy-2.4.9/src/output/syslogoutput.c:66:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (0 == strlen(logMessage)) { data/snoopy-2.4.9/src/output/syslogoutput.c:83: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). return strlen(logMessage); data/snoopy-2.4.9/src/parser.c:66:28: [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). argListRaw_charCount = strlen(argListRaw); data/snoopy-2.4.9/tests/bin/snoopy-test-threads.c:317:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytesRead = read(fd, buffer, sizeof(randomNrRaw)); ANALYSIS SUMMARY: Hits = 91 Lines analyzed = 12402 in approximately 0.49 seconds (25354 lines/second) Physical Source Lines of Code (SLOC) = 4294 Hits@level = [0] 231 [1] 39 [2] 40 [3] 4 [4] 8 [5] 0 Hits@level+ = [0+] 322 [1+] 91 [2+] 52 [3+] 12 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 74.9884 [1+] 21.1924 [2+] 12.1099 [3+] 2.7946 [4+] 1.86306 [5+] 0 Dot directories skipped = 2 (--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.